chef/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb
# Determine the appropriate provider for the given resource, then
# execute it.
Determine the appropriate provider for the given resource, then
execute it.
Determine the appropriate provider for the given resource then execute it .
def run_action(resource, action, notification_type = nil, notifying_resource = nil)
      before_notifications = run_context.before_notifications(resource) || []
      unless before_notifications.empty?
        forced_why_run do
          Chef::Log.info("#{resource} running why-run #{action} action to support before action")
          resource.run_action(action, notification_type, notifying_resource)
        end
        if resource.updated_by_last_action?
          before_notifications.each do |notification|
            Chef::Log.info("#{resource} sending #{notification.action} action to #{notification.resource} (before)")
            run_action(notification.resource, notification.action, :before, resource)
          end
          resource.updated_by_last_action(false)
        end
      end
      resource.run_action(action, notification_type, notifying_resource)
      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|
          notification.resource.run_context.add_delayed_action(notification)
        end
      end
    end
def run_action ( resource , action , notification_type = nil , notifying_resource = nil ) before_notifications = run_context . before_notifications ( resource ) || [ ] unless before_notifications . empty? forced_why_run do Chef :: Log . info ( "#{resource} running why-run #{action} action to support before action" ) resource . run_action ( action , notification_type , notifying_resource ) end if resource . updated_by_last_action? before_notifications . each do | notification | Chef :: Log . info ( "#{resource} sending #{notification.action} action to #{notification.resource} (before)" ) run_action ( notification . resource , notification . action , :before , resource ) end resource . updated_by_last_action ( false ) end end resource . run_action ( action , notification_type , notifying_resource ) 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 | notification . resource . run_context . add_delayed_action ( notification ) end end end
Determine the appropriate provider for the given resource, then
execute it.
Determine the appropriate provider for the given resource then execute it .
# If there are any before notifications, why-run the resource # and notify anyone who needs notifying # Actually run the action for realsies # 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. # send the notification to the run_context of the receiving resource
resource
action
notification_type
notifying_resource