summaryrefslogtreecommitdiffstats
path: root/lib/puppet/transaction.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-11-01 10:47:50 -0600
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitf8d7c44fea37dff3e9a86652699bffeab0fbe111 (patch)
tree8c5518e4fd9ba2ae5f20cf4c2b9cac21e21c4019 /lib/puppet/transaction.rb
parentee9cff91e1a22a52162d0b8de2aba57f1bbb7e76 (diff)
downloadpuppet-f8d7c44fea37dff3e9a86652699bffeab0fbe111.tar.gz
puppet-f8d7c44fea37dff3e9a86652699bffeab0fbe111.tar.xz
puppet-f8d7c44fea37dff3e9a86652699bffeab0fbe111.zip
Moving event creation to the resource
This allows the Transaction class to reuse the event creation code when it creates noop and restart events. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/transaction.rb')
-rw-r--r--lib/puppet/transaction.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb
index a5feecbc2..0a26e33fe 100644
--- a/lib/puppet/transaction.rb
+++ b/lib/puppet/transaction.rb
@@ -409,7 +409,7 @@ class Puppet::Transaction
end
if restarted
- queue_event(resource, Puppet::Transaction::Event.new(:restarted, resource))
+ queue_event(resource, resource.event(:name => :restarted, :status => "success"))
@resourcemetrics[:restarted] += 1
end
@@ -544,7 +544,8 @@ class Puppet::Transaction
end
def process_callback(resource, callback, events)
- process_noop_events(resource, callback, events) and return false if events.detect { |e| e.name == :noop }
+ # XXX Should it be any event, or all events?
+ process_noop_events(resource, callback, events) and return false unless events.detect { |e| e.status != "noop" }
resource.send(callback)
resource.notice "Triggered '#{callback}' from #{events.length} events"
@@ -561,7 +562,7 @@ class Puppet::Transaction
resource.notice "Would have triggered '#{callback}' from #{events.length} events"
# And then add an event for it.
- queue_event(resource, Puppet::Transaction::Event.new(:noop, resource))
+ queue_event(resource, resource.event(:status => "noop", :name => :noop_restart))
true # so the 'and if' works
end
end