Clint Howarth avatar Clint Howarth committed 7fd0344

fix email notification, respect spam flag

Comments (0)

Files changed (2)

 
     email_recipients = config_block.get(task_params.TASK_EMAIL, None)
     if email_recipients:
-        email_recipients = ",".split(email_recipients)
+        email_recipients = email_recipients.split(",")
     else:
         email_recipients = []
 
+    spam = config_block.get(task_params.SPAM, None)
+
     unparsed_interval = config_block.get(task_params.TASK_INTERVAL, None)
     parsed_interval = timing.parse_interval(unparsed_interval)
 
         task_params.FAIL_BY_STDERR: fail_by_stderr,
         task_params.FAIL_BY_RETCODE: fail_by_retcode,
         task_params.CONFIG: config_block,
+        task_params.SPAM: spam,
     }
 
     # In erroneous configurations, we add a dummy job with an

speedrack/models.py

         # email 'if needed'
         # TODO: this -> somewhere else?
         if not app.config.get(con.EMAIL_DISABLED, None):
+            app.logger.debug("{0} testing for signal (run)".format(self.name))
             response = self.needs_notification(execution)
-            if response:
+            app.logger.debug("{0} test response: {1}".format(self.name, response))
+            if response is not False:
+                app.logger.debug("{0} sending email".format(self.name))
                 self.send_email(execution, response)
 
         # cleanup old runs if needed
         if self.email_recipients:
             to_addresses.extend(self.email_recipients)
 
+        app.logger.debug("Attempting to send email to: {0}".format(str(to_addresses)))
+
         from_address = app.config.get(con.EMAIL_FROM_ADDRESS)
         smtp_server = app.config.get(con.EMAIL_SMTP)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.