diff --git a/teuthology/results.py b/teuthology/results.py index aae991eaf..b72695e51 100644 --- a/teuthology/results.py +++ b/teuthology/results.py @@ -75,15 +75,11 @@ def results(archive_dir, name, email, timeout, dry_run): print("Subject: %s" % subject) print(body) elif email: - email_results( - subject=subject, - from_=(config.results_sending_email or 'teuthology'), - to=email, - body=body, - ) + sender = config.results_sending_email or 'teuthology' + email_results(config, subject, sender, to, body) -def email_results(subject, from_, to, body): +def email_results(config, subject, from_, to, body): log.info('Sending results to {to}: {body}'.format(to=to, body=body)) import smtplib from email.mime.text import MIMEText @@ -91,6 +87,12 @@ def email_results(subject, from_, to, body): msg['Subject'] = subject msg['From'] = from_ msg['To'] = to + suite = config.get('suite') + if suite is not None: + msg['QA-suite'] = suite + user = config.get('user') + if user is not None: + msg['QA-user'] = user log.debug('sending email %s', msg.as_string()) smtp = smtplib.SMTP('localhost') smtp.sendmail(msg['From'], [msg['To']], msg.as_string()) diff --git a/teuthology/run.py b/teuthology/run.py index e065495cf..2e97956df 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -281,9 +281,8 @@ def report_outcome(config, archive, summary, fake_ctx): and not passed): config_dump = yaml.safe_dump(config) subject = "Teuthology error -- %s" % summary['failure_reason'] - email_results(subject, "Teuthology", config['email-on-error'], - "\n".join([summary_dump, config_dump])) - + body = "\n".join([summary_dump, config_dump]) + email_results(config, subject, "Teuthology", body) report.try_push_job_info(config, summary)