# 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 if failed? && !exception.is_a?(SystemExit) subject = "Chef run failed on #{node.name}" message = "#{run_status.formatted_exception}\n" elsif elapsed_time > 600 subject = "Chef run took #{elapsed_time} on #{node.name}" message = "" end return unless subject message << Array(backtrace).join("\n") require "mail" Mail.deliver do to @config[:to] from @config[:from] subject subject body message end end end end end