Commits

Wil Tan  committed 760e158 Merge

merged from upstream? (confused by hg)

  • Participants
  • Parent commits b3d7894, 77ceda6

Comments (0)

Files changed (3)

+"""
+Schedule a ``Build`` for all recipes.
+"""
+from factory.models import FabfileRecipe, Build
+from datetime import datetime
+
+DEFAULT_TASK = 'build_and_test'
+
+for recipe in FabfileRecipe.objects.all():
+    name = "%s %s" % (recipe.name, datetime.now().strftime("%d/%m/%Y"))
+    b = Build.objects.create(name=name,
+                             task=DEFAULT_TASK,
+                             fabfile_recipe=recipe)
+
+

File src/factory/signals.py

 from django.db.models.signals import pre_save
 from django.core.mail import send_mail
 from django.conf import settings
+import logging
+
 
 def send_build_email(instance, **kwargs):
     if not instance.executed:
                output=instance.output,
                error=instance.error)
 
-    send_mail(subject, msg, settings.SERVER_EMAIL,
-              [instance.fabfile_recipe.notify], fail_silently=False)
+    try:
+        send_mail(subject, msg, settings.SERVER_EMAIL,
+                  [instance.fabfile_recipe.notify], fail_silently=False)
+    except:
+        if settings.DEBUG:
+            raise
+        # in production, if sending this email fails, django is unlikely to send the error mail either
+        # so we just ignore the error
+        logging.getLogger(__name__).exception("unable to send build email")
 
 
 

File src/project/settings.py

                     filename=LOGGING_LOGFILE,
                     filemode="a")
 
+FF_EMAIL_BUILD_RESULTS = "failed" # (True|False|"failed") - "failed" will email only if build failed
+
 try:
     from project.local_settings import *
 except:
     pass
-
-
-FF_EMAIL_BUILD_RESULTS = "failed"