autobuild: do not try to send email to no recipient
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 22 Mar 2018 22:24:16 +0000 (11:24 +1300)
committerDouglas Bagnall <dbagnall@samba.org>
Sat, 5 May 2018 02:32:42 +0000 (04:32 +0200)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
script/autobuild.py

index 5a7b7bc32c88b00df007f51586a5a44e7f5f08dd..65b89d1b40a9749e54399082aa7c5aec2022822b 100755 (executable)
@@ -692,6 +692,11 @@ parser.add_option("", "--restrict-tests", help="run as make test with this TESTS
                   default='')
 
 def send_email(subject, text, log_tar):
+    if options.email is None:
+        do_print("not sending email because the recipient is not set")
+        do_print("the text content would have been:\n\nSubject: %s\n\nTs" %
+                 (subject, text))
+        return
     outer = MIMEMultipart()
     outer['Subject'] = subject
     outer['To'] = options.email