[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:34:52 UTC 2010


The following commit has been merged in the upstream branch:
commit 0dd4201697117645d4f4137b4678dd90671a4a89
Author: Luke Kanies <luke at puppetlabs.com>
Date:   Wed May 19 23:33:41 2010 -0700

    Fixing #3072 - Resource generation is recursive
    
    This allows you to create builtin nested resource types
    that generate other resources that generate other resources
    ad naseum.
    
    The primary point of this feature is that you can make
    builtin resource types that have a lot of the same
    encapsulation abilities of defined resource types.
    
    Signed-off-by: Luke Kanies <luke at puppetlabs.com>

diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index 8856324..ebbc789 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -198,6 +198,9 @@ class Puppet::Transaction
                 @catalog.add_resource(res) do |r|
                     r.finish
                     make_parent_child_relationship(resource, [r])
+
+                    # Call 'generate' recursively
+                    generate_additional_resources(r, method)
                 end
                 true
             rescue Puppet::Resource::Catalog::DuplicateResourceError
diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb
index c5b0ea4..999dc77 100755
--- a/spec/unit/transaction.rb
+++ b/spec/unit/transaction.rb
@@ -190,6 +190,21 @@ describe Puppet::Transaction do
     end
 
     describe "when generating resources" do
+        it "should call 'generate' on all created resources" do
+            first = Puppet::Type.type(:notify).new(:name => "first")
+            second = Puppet::Type.type(:notify).new(:name => "second")
+            third = Puppet::Type.type(:notify).new(:name => "third")
+
+            @catalog = Puppet::Resource::Catalog.new
+            @transaction = Puppet::Transaction.new(@catalog)
+
+            first.expects(:generate).returns [second]
+            second.expects(:generate).returns [third]
+            third.expects(:generate)
+
+            @transaction.generate_additional_resources(first, :generate)
+        end
+
         it "should finish all resources" do
             generator = stub 'generator', :depthfirst? => true, :tags => []
             resource = stub 'resource', :tag => nil

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list