reporting: Skip sending mails if there is no recipient.
This will resolve the issue that a suite job crashes when it
attempts to send a mail to no recipient.
BUG=chromium:737836
TEST=run_pylint.py
Change-Id: I38d7cfc155adb4546da3ea447026a6d153c1d197
Reviewed-on: https://chromium-review.googlesource.com/554398
Commit-Ready: Shuhei Takahashi <nya@chromium.org>
Tested-by: Shuhei Takahashi <nya@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
diff --git a/server/cros/dynamic_suite/reporting.py b/server/cros/dynamic_suite/reporting.py
index 004f21f..7680530 100644
--- a/server/cros/dynamic_suite/reporting.py
+++ b/server/cros/dynamic_suite/reporting.py
@@ -987,6 +987,9 @@
if bug_template.get('owner'):
to_set.add(bug_template.get('owner'))
recipients = ', '.join(to_set)
+ if not recipients:
+ logging.warning('No owner/cc found. Will skip sending a mail.')
+ return
success = False
try:
gmail_lib.send_email(