From c7a6ef2889b0fb2507e5be98a1dd29b69957a216 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Mon, 6 Oct 2008 22:39:56 +0200 Subject: 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 --- lib/puppet/parser/ast/collexpr.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/puppet') 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 -- cgit