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 <[EMAIL PROTECTED]>
---
 CHANGELOG                     |    2 ++
 lib/puppet/parser/resource.rb |    2 +-
 spec/unit/parser/resource.rb  |   10 ++++++++++
 3 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 2b61921..94d0581 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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 d214a60..747338b 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 = [EMAIL PROTECTED], val].flatten
diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb
index 6b20219..63cfbc2 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")
-- 
1.5.3.7


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to