[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

test branch puppet-dev at googlegroups.com
Wed Jul 14 10:32:51 UTC 2010


The following commit has been merged in the upstream branch:
commit ee0cc07544df334cdc549907b4dca8d8d115b7b7
Author: Luke Kanies <luke at puppetlabs.com>
Date:   Mon Apr 12 22:33:32 2010 -0700

    Fixing #3533 - Removing all transaction cleanup
    
    It's really slow and has no actual functionality
    any more, since we just remove the catalogs from memory
    anyway.
    
    This should be a good speed boost for very little effort.
    
    Signed-off-by: Luke Kanies <luke at puppetlabs.com>

diff --git a/lib/puppet/resource/catalog.rb b/lib/puppet/resource/catalog.rb
index 0489204..6aeda09 100644
--- a/lib/puppet/resource/catalog.rb
+++ b/lib/puppet/resource/catalog.rb
@@ -158,7 +158,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
     ensure
         @applying = false
         cleanup()
-        transaction.cleanup if defined? transaction and transaction
     end
 
     # Are we in the middle of applying the catalog?
@@ -506,12 +505,6 @@ class Puppet::Resource::Catalog < Puppet::SimpleGraph
     private
 
     def cleanup
-        unless @transient_resources.empty?
-            remove_resource(*@transient_resources)
-            @transient_resources.clear
-            @relationship_graph = nil
-        end
-
         # Expire any cached data the resources are keeping.
         expire()
     end
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index e9a1934..f8ed503 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -58,14 +58,6 @@ class Puppet::Transaction
         report.resource_statuses.values.find_all { |status| status.changed }.collect { |status| catalog.resource(status.resource) }
     end
 
-    # Do any necessary cleanup.  If we don't get rid of the graphs, the
-    # contained resources might never get cleaned up.
-    def cleanup
-        if defined? @generated
-            catalog.remove_resource(*@generated)
-        end
-    end
-
     # Copy an important relationships from the parent to the newly-generated
     # child resource.
     def make_parent_child_relationship(resource, children)
diff --git a/spec/unit/resource/catalog.rb b/spec/unit/resource/catalog.rb
index afa98fa..a7caf09 100755
--- a/spec/unit/resource/catalog.rb
+++ b/spec/unit/resource/catalog.rb
@@ -576,7 +576,6 @@ describe Puppet::Resource::Catalog, "when compiling" do
             @transaction = mock 'transaction'
             Puppet::Transaction.stubs(:new).returns(@transaction)
             @transaction.stubs(:evaluate)
-            @transaction.stubs(:cleanup)
             @transaction.stubs(:add_times)
         end
 
@@ -597,11 +596,6 @@ describe Puppet::Resource::Catalog, "when compiling" do
             @catalog.apply
         end
 
-        it "should clean up the transaction" do
-            @transaction.expects :cleanup
-            @catalog.apply
-        end
-
         it "should return the transaction" do
             @catalog.apply.should equal(@transaction)
         end
@@ -626,37 +620,6 @@ describe Puppet::Resource::Catalog, "when compiling" do
             @catalog.apply(:ignoreschedules => true)
         end
 
-        it "should remove resources created mid-transaction" do
-            args = {:name => "/yay", :ensure => :file}
-            resource = stub 'file', :ref => "File[/yay]", :catalog= => @catalog, :title => "/yay", :[] => "/yay"
-            @transaction = mock 'transaction'
-            Puppet::Transaction.stubs(:new).returns(@transaction)
-            @transaction.stubs(:evaluate)
-            @transaction.stubs(:cleanup)
-            @transaction.stubs(:add_times)
-            Puppet::Type.type(:file).expects(:new).with(args).returns(resource)
-            resource.expects :remove
-            @catalog.apply do |trans|
-                @catalog.create_resource :file, args
-                @catalog.resource("File[/yay]").should equal(resource)
-            end
-            @catalog.resource("File[/yay]").should be_nil
-        end
-
-        it "should remove resources added mid-transaction" do
-            @transaction = mock 'transaction'
-            Puppet::Transaction.stubs(:new).returns(@transaction)
-            @transaction.stubs(:evaluate)
-            @transaction.stubs(:cleanup)
-            @transaction.stubs(:add_times)
-            file = Puppet::Type.type(:file).new(:name => "/yay", :ensure => :file)
-            @catalog.apply do |trans|
-                @catalog.add_resource file
-                @catalog.resource("File[/yay]").should_not be_nil
-            end
-            @catalog.resource("File[/yay]").should be_nil
-        end
-
         it "should expire cached data in the resources both before and after the transaction" do
             @catalog.expects(:expire).times(2)
             @catalog.apply
diff --git a/test/other/transactions.rb b/test/other/transactions.rb
index 9a3afbd..5c21755 100755
--- a/test/other/transactions.rb
+++ b/test/other/transactions.rb
@@ -150,11 +150,6 @@ class TestTransactions < Test::Unit::TestCase
                 "Generated %s was not a vertex" % name)
             assert($finished.include?(name), "%s was not finished" % name)
         end
-
-        # Now make sure that cleanup gets rid of those generated types.
-        assert_nothing_raised do
-            trans.cleanup
-        end
     end
 
     def test_ignore_tags?

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list