def run_action(action, notification_type=nil, notifying_resource=nil)
@elapsed_time = 0
start_time = Time.now
events.resource_action_start(self, action, notification_type, notifying_resource)
resolve_notification_references
validate_action(action)
if Chef::Config[:verbose_logging] || Chef::Log.level == :debug
Chef::Log.info("Processing #{self} action #{action} (#{defined_at})")
end
updated_by_last_action(false)
begin
return if should_skip?(action)
provider_for_action(action).run_action
rescue Exception => e
if ignore_failure
Chef::Log.error("#{self} (#{defined_at}) had an error: #{e.message}; ignore_failure is set, continuing")
events.resource_failed(self, action, e)
elsif retries > 0
events.resource_failed_retriable(self, action, retries, e)
@retries -= 1
Chef::Log.info("Retrying execution of #{self}, #{retries} attempt(s) left")
sleep retry_delay
retry
else
events.resource_failed(self, action, e)
raise customize_exception(e)
end
ensure
@elapsed_time = Time.now - start_time
events.resource_completed(self)
end
end