This class is responsible for executing the steps in a Chef run.
Iterates over the resource_collection in the run_context calling run_action for each resource in turn.
# File lib/chef/runner.rb, line 73 def converge # Resolve all lazy/forward references in notifications run_context.resource_collection.each do |resource| resource.resolve_notification_references end # Execute each resource. run_context.resource_collection.execute_each_resource do |resource| Array(resource.action).each {|action| run_action(resource, action)} end # Run all our :delayed actions delayed_actions.each do |notification| Chef::Log.info( "#{notification.notifying_resource} sending #{notification.action}" " action to #{notification.resource} (delayed)") # Struct of resource/action to call run_action(notification.resource, notification.action, :delayed) end true end
# File lib/chef/runner.rb, line 42 def events @run_context.events end
Determine the appropriate provider for the given resource, then execute it.
# File lib/chef/runner.rb, line 48 def run_action(resource, action, notification_type=nil, notifying_resource=nil) 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| if delayed_actions.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 delayed_actions << notification end end end end
Generated with the Darkfish Rdoc Generator 2.