[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Markus Roberts Markus at reality.com
Tue May 10 08:10:18 UTC 2011


The following commit has been merged in the experimental branch:
commit fa5c2b1b1494cc760f95c95e6e50a304c2651c7b
Author: Markus Roberts <Markus at reality.com>
Date:   Thu Mar 31 16:41:11 2011 -0700

    (6911) Cleanup of generate_additional_resources
    
    The previous commit left only one meaningful value for the method parameter
    of generate_additional_resources, making it a constant not a parameter.  This
    commit removes it.
    
    Paired-with: Jesse Wolfe

diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index aa0eec3..ad79f17 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -173,13 +173,13 @@ class Puppet::Transaction
 
   # A general method for recursively generating new resources from a
   # resource.
-  def generate_additional_resources(resource, method, presume_prefix_dependencies=false)
-    return [] unless resource.respond_to?(method)
+  def generate_additional_resources(resource)
+    return [] unless resource.respond_to?(:generate)
     begin
-      made = resource.send(method)
+      made = resource.generate
     rescue => detail
       puts detail.backtrace if Puppet[:trace]
-      resource.err "Failed to generate additional resources using '#{method}': #{detail}"
+      resource.err "Failed to generate additional resources using 'generate': #{detail}"
     end
     return [] unless made
     made = [made] unless made.is_a?(Array)
@@ -189,7 +189,7 @@ class Puppet::Transaction
         @catalog.add_resource(res)
         res.finish
         make_parent_child_relationship(resource, res)
-        generate_additional_resources(res, method, presume_prefix_dependencies)
+        generate_additional_resources(res)
         true
       rescue Puppet::Resource::Catalog::DuplicateResourceError
         res.info "Duplicate generated resource; skipping"
@@ -205,7 +205,7 @@ class Puppet::Transaction
     newlist = []
     while ! list.empty?
       list.each do |resource|
-        newlist += generate_additional_resources(resource, :generate)
+        newlist += generate_additional_resources(resource)
       end
       list = newlist
       newlist = []
diff --git a/spec/unit/transaction_spec.rb b/spec/unit/transaction_spec.rb
index 5867f2e..57bf800 100755
--- a/spec/unit/transaction_spec.rb
+++ b/spec/unit/transaction_spec.rb
@@ -197,7 +197,7 @@ describe Puppet::Transaction do
       second.expects(:generate).returns [third]
       third.expects(:generate)
 
-      @transaction.generate_additional_resources(first, :generate)
+      @transaction.generate_additional_resources(first)
     end
 
     it "should finish all resources" do
@@ -213,7 +213,7 @@ describe Puppet::Transaction do
 
       resource.expects(:finish)
 
-      @transaction.generate_additional_resources(generator, :generate)
+      @transaction.generate_additional_resources(generator)
     end
 
     it "should skip generated resources that conflict with existing resources" do
@@ -230,7 +230,7 @@ describe Puppet::Transaction do
       resource.expects(:finish).never
       resource.expects(:info) # log that it's skipped
 
-      @transaction.generate_additional_resources(generator, :generate).should be_empty
+      @transaction.generate_additional_resources(generator).should be_empty
     end
 
     it "should copy all tags to the newly generated resources" do
@@ -247,7 +247,7 @@ describe Puppet::Transaction do
       child.expects(:finish)
       generator.expects(:depthfirst?)
 
-      @transaction.generate_additional_resources(generator, :generate)
+      @transaction.generate_additional_resources(generator)
     end
   end
 

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list