diff options
-rw-r--r-- | lib/puppet/parser/resource.rb | 1 | ||||
-rwxr-xr-x | spec/unit/parser/resource.rb | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 12c1a8f52..fef0b54ca 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -352,6 +352,7 @@ class Puppet::Parser::Resource # LAK:NOTE Relationship metaparams get treated specially -- we stack them, instead of # overriding. next if @params[name] and not self.class.relationship_parameter?(name) + next if @params[name] and @params[name].value == :undef # Skip metaparams for which we get no value. next unless val = scope.lookupvar(name.to_s, false) and val != :undefined diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb index 648f3a6b4..410494d43 100755 --- a/spec/unit/parser/resource.rb +++ b/spec/unit/parser/resource.rb @@ -195,6 +195,15 @@ describe Puppet::Parser::Resource do @resource["require"].sort.should == %w{container resource} end + it "should not stack relationship metaparams that are set to 'undef'" do + @resource.set_parameter("require", :undef) + @scope.setvar("require", "container") + + @resource.class.publicize_methods(:add_metaparams) { @resource.add_metaparams } + + @resource["require"].should == :undef + end + it "should flatten the array resulting from stacking relationship metaparams" do @resource.set_parameter("require", ["resource1", "resource2"]) @scope.setvar("require", %w{container1 container2}) |