summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-05-30 20:15:08 +0200
committerJames Turnbull <james@lovedthanlost.net>2009-06-06 09:52:53 +1000
commitd69fffb63ca9efe3cca67167430b23d3b8d38fa4 (patch)
treeea6c622f8610db44fd874f877a9a5aee6fe89a73
parent6ce0d1e633780a71ec3597a90120d67d77a5d89f (diff)
downloadpuppet-d69fffb63ca9efe3cca67167430b23d3b8d38fa4.tar.gz
puppet-d69fffb63ca9efe3cca67167430b23d3b8d38fa4.tar.xz
puppet-d69fffb63ca9efe3cca67167430b23d3b8d38fa4.zip
Fix #2246 - Array tagged resources can't be collected or exported
I don't know why we imposed the restriction that we shouldn't match with parameter containing arrays in exported mode. That doesn't seem right, as the produced rails query works fine with arrays. Note: the user tags are not stored in the rails database except under the special resource parameter tag. This also doesn't seem right. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
-rw-r--r--lib/puppet/parser/ast/collexpr.rb2
-rwxr-xr-xspec/unit/parser/ast/collexpr.rb6
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/puppet/parser/ast/collexpr.rb b/lib/puppet/parser/ast/collexpr.rb
index 85bca583f..54b003a91 100644
--- a/lib/puppet/parser/ast/collexpr.rb
+++ b/lib/puppet/parser/ast/collexpr.rb
@@ -31,7 +31,7 @@ class CollExpr < AST::Branch
when "and"; code1.call(resource) and code2.call(resource)
when "or"; code1.call(resource) or code2.call(resource)
when "=="
- if resource[str1].is_a?(Array) && form != :exported
+ if resource[str1].is_a?(Array)
resource[str1].include?(str2)
else
resource[str1] == str2
diff --git a/spec/unit/parser/ast/collexpr.rb b/spec/unit/parser/ast/collexpr.rb
index 51cd820a2..e45203492 100755
--- a/spec/unit/parser/ast/collexpr.rb
+++ b/spec/unit/parser/ast/collexpr.rb
@@ -74,16 +74,18 @@ describe Puppet::Parser::AST::CollExpr do
end
end
- it "should check for array member equality if resource parameter is an array for ==" do
+ [:exported,:virtual].each do |mode|
+ it "should check for array member equality if resource parameter is an array for == in mode #{mode}" do
array = mock 'array', :safeevaluate => "array"
test1 = mock 'test1'
test1.expects(:safeevaluate).with(@scope).returns("test1")
resource = mock 'resource'
resource.expects(:[]).with("array").at_least(1).returns(["test1","test2","test3"])
- collexpr = ast::CollExpr.new(:test1 => array, :test2 => test1, :oper => "==")
+ collexpr = ast::CollExpr.new(:test1 => array, :test2 => test1, :oper => "==", :form => mode)
collexpr.evaluate(@scope)[1].call(resource).should be_true
end
+ end
it "should raise an error for invalid operator" do
lambda { collexpr = ast::CollExpr.new(:oper=>">") }.should raise_error