class Poise::Subcontext::Runner
A subclass of the normal Chef Runner
that migrates delayed notifications to the enclosing run_context instead of running them at the end of the subcontext convergence.
@api private @since 1.0.0
Public Class Methods
new(resource, *args)
click to toggle source
Calls superclass method
# File lib/poise/subcontext/runner.rb, line 29 def initialize(resource, *args) super(*args) @resource = resource end
Public Instance Methods
run_delayed_notifications(error=nil)
click to toggle source
Calls superclass method
# File lib/poise/subcontext/runner.rb, line 34 def run_delayed_notifications(error=nil) # If there is an error, just do the normal thing. The return shouldn't # ever fire because the superclass re-raises if there is an error. return super if error delayed_actions.each do |notification| if @resource.run_context.respond_to?(:add_delayed_action) @resource.run_context.add_delayed_action(notification) else notifications = run_context.parent_run_context.delayed_notifications(@resource) if notifications.any? { |existing_notification| existing_notification.duplicates?(notification) } Chef::Log.info( "#{@resource} not queuing delayed action #{notification.action} on #{notification.resource}"\ " (delayed), as it's already been queued") else notifications << notification end end end end