diff options
-rw-r--r-- | lib/puppet/node/catalog.rb | 2 | ||||
-rw-r--r-- | lib/puppet/transaction.rb | 2 | ||||
-rwxr-xr-x | spec/unit/node/catalog.rb | 10 | ||||
-rw-r--r-- | test/lib/puppettest/support/utils.rb | 6 | ||||
-rwxr-xr-x | test/ral/types/basic.rb | 5 |
5 files changed, 11 insertions, 14 deletions
diff --git a/lib/puppet/node/catalog.rb b/lib/puppet/node/catalog.rb index 4d5100c1d..ff41031e1 100644 --- a/lib/puppet/node/catalog.rb +++ b/lib/puppet/node/catalog.rb @@ -328,7 +328,7 @@ class Puppet::Node::Catalog < Puppet::PGraph # Lastly, add in any autorequires @relationship_graph.vertices.each do |vertex| - vertex.autorequire(@relationship_graph).each do |edge| + vertex.autorequire(self).each do |edge| unless @relationship_graph.edge?(edge.source, edge.target) # don't let automatic relationships conflict with manual ones. unless @relationship_graph.edge?(edge.target, edge.source) vertex.debug "Autorequiring %s" % [edge.source] diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index e1ad6eb58..b5fbf2b0a 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -505,7 +505,7 @@ class Transaction # Now add any dynamically generated resources generate() - + # This will throw an error if there are cycles in the graph. @sorted_resources = relationship_graph.topsort end diff --git a/spec/unit/node/catalog.rb b/spec/unit/node/catalog.rb index 6f246f6b3..4f9613d00 100755 --- a/spec/unit/node/catalog.rb +++ b/spec/unit/node/catalog.rb @@ -618,13 +618,17 @@ 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/three" + + @sub.stubs(:autorequire).returns([Puppet::Relationship.new(@two, @sub)]) + @catalog.add_edge! @compone, @one @catalog.add_edge! @comptwo, @two @three = @file.create :path => "/three" @four = @file.create :path => "/four", :require => ["file", "/three"] @five = @file.create :path => "/five" - @catalog.add_resource @compone, @comptwo, @one, @two, @three, @four, @five + @catalog.add_resource @compone, @comptwo, @one, @two, @three, @four, @five, @sub @relationships = @catalog.relationship_graph end @@ -659,6 +663,10 @@ describe Puppet::Node::Catalog, " when creating a relationship graph" do @relationships.edge?(@one, @two).should be_true end + it "should add automatic relationships to the relationship graph" do + @relationships.edge?(@two, @sub).should be_true + end + it "should get removed when the catalog is cleaned up" do @relationships.expects(:clear).with(false) @catalog.clear diff --git a/test/lib/puppettest/support/utils.rb b/test/lib/puppettest/support/utils.rb index cb4a6924c..b749c7931 100644 --- a/test/lib/puppettest/support/utils.rb +++ b/test/lib/puppettest/support/utils.rb @@ -42,12 +42,6 @@ module PuppetTest::Support::Utils # stop any services that might be hanging around def stopservices - if stype = Puppet::Type.type(:service) - stype.each { |service| - service[:ensure] = :stopped - service.evaluate - } - end end # TODO: rewrite this to use the 'etc' module. diff --git a/test/ral/types/basic.rb b/test/ral/types/basic.rb index daffabf58..e46d96d1c 100755 --- a/test/ral/types/basic.rb +++ b/test/ral/types/basic.rb @@ -40,11 +40,6 @@ class TestBasic < Test::Unit::TestCase @config.add_edge! @component, @command end - def teardown - super - stopservices - end - def test_values [:ensure, :checksum].each do |param| prop = @configfile.property(param) |