Commits

dready committed ccff446

option to email only if job failed

Comments (0)

Files changed (2)

src/factory/signals.py

 from django.conf import settings
 
 def send_build_email(instance, **kwargs):
-    if not getattr(settings, 'FF_EMAIL_BUILD_RESULTS', False):
-        return
-
     if not instance.executed:
         return
 
     if not instance.fabfile_recipe.notify:
         return
 
+    email_results = getattr(settings, 'FF_EMAIL_BUILD_RESULTS', False)
+    if not email_results or (email_results is "failed" and instance.success):
+        return
+
     subject = '%s Build Results (%s)' % (instance, "success" if instance.success else "failure")
     msg = """
     Tasks: %(task)s

src/project/settings.py

     pass
 
 
-FF_EMAIL_BUILD_RESULTS = True
+FF_EMAIL_BUILD_RESULTS = "failed"