diff options
author | Luke Kanies <luke@madstop.com> | 2009-01-28 12:26:03 -0600 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-02-06 21:27:29 +1100 |
commit | 500ea2020f95f8e96663f4a56d43be62819ef929 (patch) | |
tree | 5107c59901586307b12658d8f2485cdf011bf7b5 | |
parent | 140786570176f5fcd8774f83fbf0bf4087a2cc32 (diff) | |
download | puppet-500ea2020f95f8e96663f4a56d43be62819ef929.tar.gz puppet-500ea2020f95f8e96663f4a56d43be62819ef929.tar.xz puppet-500ea2020f95f8e96663f4a56d43be62819ef929.zip |
Fixing #1914 - 'undef' relationship metaparameters do not stack
This allows you to specify that a metaparameter is undef
inside a definition and keep any parameters from being
inherited from the parent.
Signed-off-by: Luke Kanies <luke@madstop.com>
-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}) |