From 09979541ca8caf134b715666767e7ce84a9d3ed0 Mon Sep 17 00:00:00 2001 From: Warren Usui Date: Wed, 27 Feb 2013 11:32:37 -0800 Subject: [PATCH] Implement email task. Email.py was added so that the emailto attribute could be passed, and to prevent 'module object has no attribute: email' errors from happening. Run.py actual performs the email operation and calls suite.email_results to do the actual send mail operation. The information passed right now is the summary and config information. Signed-off-by: Warren Usui --- teuthology/run.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/teuthology/run.py b/teuthology/run.py index eb423a0ac99e6..f9027cb095b41 100644 --- a/teuthology/run.py +++ b/teuthology/run.py @@ -188,7 +188,14 @@ def main(): with contextlib.closing(StringIO.StringIO()) as f: yaml.safe_dump(ctx.summary, f) log.info('Summary data:\n%s' % f.getvalue()) - + with contextlib.closing(StringIO.StringIO()) as f: + if 'email-on-error' in ctx.config and not ctx.summary.get('success', False): + yaml.safe_dump(ctx.summary, f) + yaml.safe_dump(ctx.config, f) + emsg = f.getvalue() + subject = "Teuthology error -- %s" % ctx.summary['failure_reason'] + from teuthology.suite import email_results + email_results(subject,"Teuthology",ctx.config['email-on-error'],emsg) if ctx.summary.get('success', True): log.info('pass') else: @@ -196,7 +203,6 @@ def main(): import sys sys.exit(1) - def schedule(): parser = argparse.ArgumentParser(description='Schedule ceph integration tests') parser.add_argument( -- 2.39.5