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
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())
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)