summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2008-10-06 22:39:56 +0200
committerJames Turnbull <james@lovedthanlost.net>2008-10-08 11:35:42 +1100
commitc7a6ef2889b0fb2507e5be98a1dd29b69957a216 (patch)
treeff9362a30364cd063bb37cb6926079a0e60e6402 /lib/puppet
parent3281f2b73ff20d72dca2f6a5063eb1ce23eb4ab2 (diff)
downloadpuppet-c7a6ef2889b0fb2507e5be98a1dd29b69957a216.tar.gz
puppet-c7a6ef2889b0fb2507e5be98a1dd29b69957a216.tar.xz
puppet-c7a6ef2889b0fb2507e5be98a1dd29b69957a216.zip
Fix #1202 - Collection attribute matching doesn't parse arrays
This patch allows to do this: User <| groups == leads |> @user { "foo": ensure => "present", groups => ["bar","baz","leads"] } Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/ast/collexpr.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/puppet/parser/ast/collexpr.rb b/lib/puppet/parser/ast/collexpr.rb
index 3e13d9400..baed325cb 100644
--- a/lib/puppet/parser/ast/collexpr.rb
+++ b/lib/puppet/parser/ast/collexpr.rb
@@ -30,7 +30,12 @@ class CollExpr < AST::Branch
case @oper
when "and": code1.call(resource) and code2.call(resource)
when "or": code1.call(resource) or code2.call(resource)
- when "==": resource[str1] == str2
+ when "==":
+ if resource[str1].is_a?(Array) && form != :exported
+ resource[str1].include?(str2)
+ else
+ resource[str1] == str2
+ end
when "!=": resource[str1] != str2
end
end