]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/chef/templates/default/report.rb.erb
Check out and compile tools for taginfo
[chef.git] / cookbooks / chef / templates / default / report.rb.erb
index 6b8ec5b9c027cd23df9b9a602bb2139c2b2b228b..4265d0660cb18412a5070ee8ee44152cb024210f 100644 (file)
@@ -14,22 +14,33 @@ class Chef
       end
 
       def report
       end
 
       def report
+        from_address = @config[:from]
+        to_address = @config[:to]
+
         if failed? && !exception.is_a?(SystemExit)
         if failed? && !exception.is_a?(SystemExit)
-          subject = "Chef run failed on #{node.name}"
-          message = "#{run_status.formatted_exception}\n"
+          message_subject = "Chef run failed on #{node.name}"
+          message_body = "#{run_status.formatted_exception}\n"
         elsif elapsed_time > 600
         elsif elapsed_time > 600
-          subject = "Chef run took #{elapsed_time} on #{node.name}"
-          message = ""
+          message_subject = "Chef run took #{elapsed_time} on #{node.name}"
+          message_body = ""
         end
 
         end
 
-        return unless subject
+        return unless message_subject
+
+        message_body << Array(backtrace).join("\n")
 
 
-        message << Array(backtrace).join("\n")
+        require "mail"
 
 
-        require "pony"
+        Mail.defaults do
+          delivery_method :exim, :location => "/usr/sbin/exim"
+        end
 
 
-        Pony.mail(:to => @config[:to], :from => @config[:from],
-                  :subject => subject, :body => message, :via => :smtp)
+        Mail.deliver do
+          to to_address
+          from from_address
+          subject message_subject
+          body message_body
+        end
       end
     end
   end
       end
     end
   end