From 6331bfc9b6dc5140147730b3c4f79fef35265a94 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Thu, 5 Feb 2009 19:55:29 +0100 Subject: Fix #1682 - Resource titles are not flattened as they should The following manifest: $groups = ["foo", "bar"] $type_groups = ["baz", "quux"] $user_groups = [$groups, $type_groups] notify{ $user_groups: } which outputs: notice: foo notice: //Notify[foobar]/message: defined 'message' as 'foo' notice: baz notice: //Notify[bazquux]/message: defined 'message' as 'baz' is not equivalent to $user_groups = [ ["foo", "bar"], ["baz", "quux"] ] notify{ $user_groups: } which outputs: notice: foo notice: //Notify[foo]/message: defined 'message' as 'foo' notice: baz notice: //Notify[baz]/message: defined 'message' as 'baz' notice: bar notice: //Notify[bar]/message: defined 'message' as 'bar' notice: quux notice: //Notify[quux]/message: defined 'message' as 'quux' Obviously the second one manages to flatten the arrays and not the first one. This changeset adds flattening to the resource titles evaluations in order to be consitent in all cases. Signed-off-by: Brice Figureau --- lib/puppet/parser/ast/resource.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/puppet') diff --git a/lib/puppet/parser/ast/resource.rb b/lib/puppet/parser/ast/resource.rb index 1a07fc585..802410b20 100644 --- a/lib/puppet/parser/ast/resource.rb +++ b/lib/puppet/parser/ast/resource.rb @@ -30,7 +30,7 @@ class Resource < AST::ResourceReference # This is where our implicit iteration takes place; if someone # passed an array as the name, then we act just like the called us # many times. - objtitles.collect { |objtitle| + objtitles.flatten.collect { |objtitle| exceptwrap :type => Puppet::ParseError do exp = self.exported || scope.resource.exported? # We want virtual to be true if exported is true. We can't -- cgit