class Chef::Runner

Chef::Runner

This class is responsible for executing the steps in a Chef run.

Public Instance Methods

delayed_actions() click to toggle source
# File files/lib/chef_compat/monkeypatches/chef/runner.rb, line 33
def delayed_actions
  @run_context.delayed_actions
end
run_action(resource, action, notification_type = nil, notifying_resource = nil) click to toggle source

Determine the appropriate provider for the given resource, then execute it.

# File files/lib/chef_compat/monkeypatches/chef/runner.rb, line 39
def run_action(resource, action, notification_type = nil, notifying_resource = nil)
  # Actually run the action for realsies
  resource.run_action(action, notification_type, notifying_resource)

  # Execute any immediate and queue up any delayed notifications
  # associated with the resource, but only if it was updated *this time*
  # we ran an action on it.
  if resource.updated_by_last_action?
    run_context.immediate_notifications(resource).each do |notification|
      Chef::Log.info("#{resource} sending #{notification.action} action to #{notification.resource} (immediate)")
      run_action(notification.resource, notification.action, :immediate, resource)
    end

    run_context.delayed_notifications(resource).each do |notification|
      # send the notification to the run_context of the receiving resource
      notification.resource.run_context.add_delayed_action(notification)
    end
  end
end