diff options
-rw-r--r-- | lib/puppet/node/catalog.rb | 2 | ||||
-rw-r--r-- | lib/puppet/util/settings.rb | 4 | ||||
-rwxr-xr-x | spec/unit/node/catalog.rb | 5 | ||||
-rwxr-xr-x | spec/unit/other/transbucket.rb | 4 | ||||
-rwxr-xr-x | spec/unit/ral/type/noop_metaparam.rb | 2 | ||||
-rwxr-xr-x | spec/unit/util/settings.rb | 40 |
6 files changed, 3 insertions, 54 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb index 77e845368..c5e32a032 100644 --- a/lib/puppet/node/catalog.rb +++ b/lib/puppet/node/catalog.rb @@ -61,7 +61,7 @@ class Puppet::Node::Catalog < Puppet::PGraph def add_resource(*resources) resources.each do |resource| unless resource.respond_to?(:ref) - raise ArgumentError, "Can only add objects that respond to :ref" + raise ArgumentError, "Can only add objects that respond to :ref, not instances of %s" % resource.class end fail_unless_unique(resource) diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 089389a09..24a71516a 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -65,7 +65,6 @@ class Puppet::Util::Settings config = trans.to_catalog config.store_state = false config.apply - config.clear rescue => detail if Puppet[:trace] puts detail.backtrace @@ -589,8 +588,6 @@ Generated on #{Time.now}. raise "Could not configure for running; got %s failure(s)" % failures end end - ensure - catalog.clear end sections.each { |s| @used << s } @@ -1075,7 +1072,6 @@ Generated on #{Time.now}. return nil unless path.is_a?(String) return nil if path =~ /^\/dev/ - return nil if Puppet::Type.type(:file)[path] # skip files that are in our global resource list. objects = [] diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb index 434242103..d607b3540 100755 --- a/spec/unit/node/catalog.rb +++ b/spec/unit/node/catalog.rb @@ -514,10 +514,6 @@ describe Puppet::Node::Catalog, " when functioning as a resource container" do raise "Aliased non-isomorphic resource" end end - - after do - Puppet::Type.allclear - end end describe Puppet::Node::Catalog do @@ -647,6 +643,7 @@ describe Puppet::Node::Catalog, " when creating a relationship graph" do @file = Puppet::Type.type(:file) @one = @file.create :path => "/one" @two = @file.create :path => "/two" + @sub = @file.create :path => "/two/subdir" @catalog.add_edge @compone, @one @catalog.add_edge @comptwo, @two diff --git a/spec/unit/other/transbucket.rb b/spec/unit/other/transbucket.rb index 4494f2abb..e447c78a2 100755 --- a/spec/unit/other/transbucket.rb +++ b/spec/unit/other/transbucket.rb @@ -91,10 +91,6 @@ describe Puppet::TransBucket, " when generating a catalog" do @fakes = %w{Fake[bottom] Fake[middle] Fake[top]} end - after do - Puppet::Type.allclear - end - it "should convert all transportable objects to RAL resources" do @catalog = @top.to_catalog @users.each do |name| diff --git a/spec/unit/ral/type/noop_metaparam.rb b/spec/unit/ral/type/noop_metaparam.rb index 0cbed3714..236599ed5 100755 --- a/spec/unit/ral/type/noop_metaparam.rb +++ b/spec/unit/ral/type/noop_metaparam.rb @@ -9,8 +9,6 @@ describe Puppet::Type.type(:file).attrclass(:noop) do @file = Puppet::Type.newfile :path => "/what/ever" end - after { Puppet::Type::File.clear } - it "should accept true as a value" do lambda { @file[:noop] = true }.should_not raise_error end diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb index 9f7018697..441a3f4ef 100755 --- a/spec/unit/util/settings.rb +++ b/spec/unit/util/settings.rb @@ -476,7 +476,7 @@ describe Puppet::Util::Settings, " when being used to manage the host machine" d def stub_transaction @bucket = mock 'bucket' - @config = mock 'config', :clear => nil + @config = mock 'config' @trans = mock 'transaction' @settings.expects(:to_transportable).with(:whatever).returns(@bucket) @@ -592,14 +592,6 @@ describe Puppet::Util::Settings, " when being used to manage the host machine" d file.should be_nil end - it "should not try to manage files in memory" do - main = Puppet::Type.type(:file).create(:path => "/maindir") - - trans = @settings.to_transportable - - lambda { trans.to_catalog }.should_not raise_error - end - it "should do nothing if a catalog cannot be created" do bucket = mock 'bucket' catalog = mock 'catalog' @@ -611,34 +603,6 @@ describe Puppet::Util::Settings, " when being used to manage the host machine" d @settings.use(:mysection) end - it "should clear the catalog after applying" do - bucket = mock 'bucket' - catalog = mock 'catalog' - - @settings.expects(:to_transportable).returns bucket - bucket.expects(:to_catalog).returns catalog - catalog.stubs(:host_config=) - catalog.stubs(:apply) - catalog.expects(:clear) - - @settings.use(:mysection) - end - - it "should clear the catalog even if there is an exception during applying" do - bucket = mock 'bucket' - catalog = mock 'catalog' - - @settings.expects(:to_transportable).returns bucket - bucket.expects(:to_catalog).returns catalog - catalog.stubs(:host_config=) - catalog.expects(:apply).raises(ArgumentError) - catalog.expects(:clear) - - # We don't care about the raised exception, we just care that - # we clear the catalog even with the exception - lambda { @settings.use(:mysection) }.should raise_error - end - it "should do nothing if all specified sections have already been used" do bucket = mock 'bucket' catalog = mock 'catalog' @@ -696,6 +660,4 @@ describe Puppet::Util::Settings, " when being used to manage the host machine" d proc { @settings.use(:whatever) }.should raise_error(RuntimeError) end - - after { Puppet::Type.allclear } end |