From e6b420088978adb3b3dd930db033df6dce59f124 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Wed, 1 Apr 2009 07:22:31 -0500 Subject: Fixing #1885 - Relationships metaparams do not cascade Because we now pass catalogs around, rather than a tree of resources, we no longer lose the metaparam information in definitions and classes. Thus, we no longer need to pass them down to contained resources. Ideally we'd remove cascading of all metaparams (which is ticket #1903) but 'schedule' and 'noop' are inherently recursive but not in a way that the graph support can currently easily solve, so that's going to have to wait for a later release. Signed-off-by: Luke Kanies --- spec/unit/parser/resource.rb | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'spec/unit/parser') diff --git a/spec/unit/parser/resource.rb b/spec/unit/parser/resource.rb index a042b4e72..926f613bb 100755 --- a/spec/unit/parser/resource.rb +++ b/spec/unit/parser/resource.rb @@ -180,41 +180,22 @@ 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") + it "should not copy relationship metaparams" do + @scope.setvar("require", "bar") @resource.class.publicize_methods(:add_metaparams) { @resource.add_metaparams } - @resource["require"].sort.should == %w{container resource} + @resource["require"].should be_nil 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}) + it "should copy all metaparams that it finds" do + @scope.setvar("noop", "foo") + @scope.setvar("schedule", "bar") @resource.class.publicize_methods(:add_metaparams) { @resource.add_metaparams } - @resource["require"].sort.should == %w{container1 container2 resource1 resource2} + @resource["noop"].should == "foo" + @resource["schedule"].should == "bar" end it "should add any tags from the scope resource" do -- cgit