[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:31:22 UTC 2010


The following commit has been merged in the upstream branch:
commit bf2f08869ced5a0cac8e399f6bc35ea2c4ddc44c
Author: Jesse Wolfe <jes5199 at gmail.com>
Date:   Thu Apr 8 01:00:46 2010 -0700

    Generated resources' events are actually bound to the resource that
    generated them.

diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index e7d8f63..5f105b2 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -39,10 +39,10 @@ class Puppet::Transaction
     end
 
     # Apply all changes for a resource
-    def apply(resource)
+    def apply(resource, ancestor = nil)
         status = resource_harness.evaluate(resource)
         add_resource_status(status)
-        event_manager.queue_events(resource, status.events)
+        event_manager.queue_events(ancestor || resource, status.events)
     rescue => detail
         resource.err "Could not evaluate: #{detail}"
     end
@@ -87,19 +87,19 @@ class Puppet::Transaction
     end
 
     # Evaluate a single resource.
-    def eval_resource(resource)
+    def eval_resource(resource, ancestor = nil)
         if skip?(resource)
             resource_status(resource).skipped = true
             return
         end
 
-        eval_children_and_apply_resource(resource)
+        eval_children_and_apply_resource(resource, ancestor)
 
         # Check to see if there are any events queued for this resource
         event_manager.process_events(resource)
     end
 
-    def eval_children_and_apply_resource(resource)
+    def eval_children_and_apply_resource(resource, ancestor = nil)
         resource_status(resource).scheduled = true
 
         # We need to generate first regardless, because the recursive
@@ -109,16 +109,16 @@ class Puppet::Transaction
         if ! children.empty? and resource.depthfirst?
             children.each do |child|
                 # The child will never be skipped when the parent isn't
-                eval_resource(child, false)
+                eval_resource(child, ancestor || resource)
             end
         end
 
         # Perform the actual changes
-        apply(resource)
+        apply(resource, ancestor)
 
         if ! children.empty? and ! resource.depthfirst?
             children.each do |child|
-                eval_resource(child)
+                eval_resource(child, ancestor || resource)
             end
         end
     end
diff --git a/spec/unit/transaction.rb b/spec/unit/transaction.rb
index 2c8f605..cf0b8af 100755
--- a/spec/unit/transaction.rb
+++ b/spec/unit/transaction.rb
@@ -117,7 +117,7 @@ describe Puppet::Transaction do
         end
 
         it "should eval and apply children" do
-            @transaction.expects(:eval_children_and_apply_resource).with(@resource)
+            @transaction.expects(:eval_children_and_apply_resource).with(@resource, nil)
 
             @transaction.eval_resource(@resource)
         end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list