# DO NOT EDIT - This file is being maintained by Chef require "rubygems" class Chef class Handler class Email < Chef::Handler attr_reader :config def initialize(config = {}) @config = config @config[:from] ||= "root@openstreetmap.org" @config end def report from_address = @config[:from] to_address = @config[:to] if failed? && !exception.is_a?(SystemExit) message_subject = "Chef run failed on #{node.name}" message_body = "#{run_status.formatted_exception}\n" elsif elapsed_time > 600 message_subject = "Chef run took #{elapsed_time} on #{node.name}" message_body = "" end return unless message_subject message_body << Array(backtrace).join("\n") require "mail" Mail.deliver do to to_address from from_address subject message_subject body message_body end end end end end