diff options
author | Jesse Wolfe <jes5199@gmail.com> | 2010-04-08 01:00:46 -0700 |
---|---|---|
committer | test branch <puppet-dev@googlegroups.com> | 2010-02-17 06:50:53 -0800 |
commit | bf2f08869ced5a0cac8e399f6bc35ea2c4ddc44c (patch) | |
tree | 1b84c4dcfb5e65745b0b290d18ac38c60823eacc | |
parent | 50ed75b5c2bca5edeec2a3a6f60f6b5c16483a1a (diff) | |
download | puppet-bf2f08869ced5a0cac8e399f6bc35ea2c4ddc44c.tar.gz puppet-bf2f08869ced5a0cac8e399f6bc35ea2c4ddc44c.tar.xz puppet-bf2f08869ced5a0cac8e399f6bc35ea2c4ddc44c.zip |
Generated resources' events are actually bound to the resource that
generated them.
-rw-r--r-- | lib/puppet/transaction.rb | 16 | ||||
-rwxr-xr-x | spec/unit/transaction.rb | 2 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index e7d8f63fd..5f105b220 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 2c8f60589..cf0b8af2d 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 |