diff options
| author | Luke Kanies <luke@madstop.com> | 2008-09-24 18:08:06 -0500 |
|---|---|---|
| committer | Luke Kanies <luke@madstop.com> | 2008-09-24 18:08:06 -0500 |
| commit | 0040bc87a1a4afac3a97165cd2e6e3c38f373261 (patch) | |
| tree | 8ac4594463580f3f47fde3005b6d94ec3cc1aa0d | |
| parent | 8d5ded09b9c9c944695c015e6e95b10ccebd6fb5 (diff) | |
| download | puppet-0040bc87a1a4afac3a97165cd2e6e3c38f373261.tar.gz puppet-0040bc87a1a4afac3a97165cd2e6e3c38f373261.tar.xz puppet-0040bc87a1a4afac3a97165cd2e6e3c38f373261.zip | |
Fixed #1045 - Multiple metaparams all get added to resources.
The problem was that I was using a 'return' in a loop where
I should have been using a 'next'.
Signed-off-by: Luke Kanies <luke@madstop.com>
| -rw-r--r-- | CHANGELOG | 2 | ||||
| -rw-r--r-- | lib/puppet/parser/resource.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/parser/resource.rb | 10 |
3 files changed, 13 insertions, 1 deletions
@@ -1,4 +1,6 @@ 0.24.x + Fixed #1045 - Multiple metaparams all get added to resources. + Fixed #1595 - Internally, Property#retrieve is no longer called when no 'should' value is available for a resource. diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index d214a60ee..747338b3b 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -369,7 +369,7 @@ class Puppet::Parser::Resource next unless val = scope.lookupvar(name.to_s, false) and val != :undefined # The default case: just set the value - return set_parameter(name, val) unless @params[name] + set_parameter(name, val) and next unless @params[name] # For relationship params, though, join the values (a la #446). @params[name].value = [@params[name].value, val].flatten diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb index 6b2021916..63cfbc2ed 100755 --- a/spec/unit/parser/resource.rb +++ b/spec/unit/parser/resource.rb @@ -176,6 +176,16 @@ describe Puppet::Parser::Resource do @resource["noop"].should == "false" end + it "should copy all metaparams that it finds" do + @scope.setvar("require", "container") + @scope.setvar("notify", "container") + + @resource.class.publicize_methods(:add_metaparams) { @resource.add_metaparams } + + @resource["require"].should == "container" + @resource["notify"].should == "container" + end + it "should stack relationship metaparams from its container if it already has them" do @resource.set_parameter("require", "resource") @scope.setvar("require", "container") |
