diff options
| author | Luke Kanies <luke@madstop.com> | 2009-02-10 15:18:30 -0600 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2009-02-11 09:11:31 +1100 |
| commit | 32c2be926795ce3ce68f573367f7700e87ac8416 (patch) | |
| tree | ae52417826c45d25876f06affe5e1d5e4fbd1eb0 /spec/unit/parser | |
| parent | 0e491591d2ab88938f9b127dd8c26033e817eb1a (diff) | |
| download | puppet-32c2be926795ce3ce68f573367f7700e87ac8416.tar.gz puppet-32c2be926795ce3ce68f573367f7700e87ac8416.tar.xz puppet-32c2be926795ce3ce68f573367f7700e87ac8416.zip | |
Fixed #1884 - exported defines are collected by the exporting host
This was caused by the fix to #1472. That fix unexported
any resources collected from the local catalog.
The crux of this fix is that it separates 'exported'
and 'virtual' a bit more. It also removes no-longer-needed
functionality where resources copied their virtual or
exported bits from the enclosing define or class. This is
now obsolete because we don't evaluate virtual defined resources.
The crux of this commit is that defined resources can stay
exported even though they're evaluated, and that exported state
won't inherit to contained resources such that those then don't
get evaluated.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'spec/unit/parser')
| -rwxr-xr-x | spec/unit/parser/ast/resource.rb | 19 | ||||
| -rwxr-xr-x | spec/unit/parser/collector.rb | 8 |
2 files changed, 20 insertions, 7 deletions
diff --git a/spec/unit/parser/ast/resource.rb b/spec/unit/parser/ast/resource.rb index 1546d657f..b257cb116 100755 --- a/spec/unit/parser/ast/resource.rb +++ b/spec/unit/parser/ast/resource.rb @@ -3,7 +3,6 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::Resource do - ast = Puppet::Parser::AST before :each do @@ -19,7 +18,6 @@ describe Puppet::Parser::AST::Resource do end it "should evaluate all its parameters" do - @param1.expects(:safeevaluate).with(@scope) @resource.evaluate(@scope) @@ -86,5 +84,20 @@ describe Puppet::Parser::AST::Resource do @resource.title = titles @resource.evaluate(@scope).should == [resource] end -end + it "should generate virtual resources if it is virtual" do + @resource.virtual = true + + Puppet::Parser::Resource.expects(:new).with { |hash| hash[:virtual] == true } + + @resource.evaluate(@scope) + end + + it "should generate virtual and exported resources if it is exported" do + @resource.exported = true + + Puppet::Parser::Resource.expects(:new).with { |hash| hash[:virtual] == true and hash[:exported] == true } + + @resource.evaluate(@scope) + end +end diff --git a/spec/unit/parser/collector.rb b/spec/unit/parser/collector.rb index ede583b96..59d62d6d8 100755 --- a/spec/unit/parser/collector.rb +++ b/spec/unit/parser/collector.rb @@ -240,10 +240,10 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do one = stub 'one', :type => "Mytype", :virtual? => true, :exported? => true two = stub 'two', :type => "Mytype", :virtual? => true, :exported? => true - one.expects(:exported=).with(false) - one.expects(:virtual=).with(false) - two.expects(:exported=).with(false) - two.expects(:virtual=).with(false) + one.stubs(:exported=) + one.stubs(:virtual=) + two.stubs(:exported=) + two.stubs(:virtual=) @compiler.expects(:resources).returns([one, two]) |
