]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Implement email task.
authorWarren Usui <warren.usui@inktank.com>
Wed, 27 Feb 2013 19:32:37 +0000 (11:32 -0800)
committerSage Weil <sage@inktank.com>
Wed, 27 Feb 2013 20:28:59 +0000 (12:28 -0800)
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 <warren.usui@inktank.com>
teuthology/run.py

index eb423a0ac99e654b84fc77719c5731ae3b9652e8..f9027cb095b41db932ba8a94741b361ff0d06446 100644 (file)
@@ -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(