]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/chef/templates/default/report.rb.erb
Don't try and restart passenger on machines that don't have it
[chef.git] / cookbooks / chef / templates / default / report.rb.erb
index 518ec13837734ef1d5ea998876479cda9b46e9e3..07a8753a8a4b4ed0bc0366f6111bf754d8e9d0fd 100644 (file)
@@ -14,25 +14,28 @@ class Chef
       end
 
       def report
+        from_address = @config[:from]
+        to_address = @config[:to]
+
         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 = ""
+          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 subject
+        return unless message_subject
 
-        message << Array(backtrace).join("\n")
+        message_body << Array(backtrace).join("\n")
 
         require "mail"
 
         Mail.deliver do
-          to @config[:to]
-          from @config[:from]
-          subject subject
-          body message
+          to to_address
+          from from_address
+          subject message_subject
+          body message_body
         end
       end
     end