"""
-usage: teuthology-results [-h] [-v] [--email EMAIL] [--timeout TIMEOUT] --archive-dir DIR --name NAME
+usage: teuthology-results [-h] [-v] [--dry-run] [--email EMAIL] [--timeout TIMEOUT] --archive-dir DIR --name NAME
Email teuthology suite results
optional arguments:
-h, --help show this help message and exit
-v, --verbose be more verbose
+ --dry-run Instead of sending the email, just print it
--email EMAIL address to email test failures to
--timeout TIMEOUT how many seconds to wait for all tests to finish (default
no wait)
if args['--verbose']:
teuthology.log.setLevel(logging.DEBUG)
- log_path = os.path.join(args['--archive-dir'], 'results.log')
- teuthology.setup_log_file(log_path)
+ if not args['--dry-run']:
+ log_path = os.path.join(args['--archive-dir'], 'results.log')
+ teuthology.setup_log_file(log_path)
try:
results(args['--archive-dir'], args['--name'], args['--email'],
- args['--timeout'])
+ args['--timeout'], args['--dry-run'])
except Exception:
log.exception('error generating results')
raise
-def results(archive_dir, name, email, timeout):
+def results(archive_dir, name, email, timeout, dry_run):
archive_base = os.path.split(archive_dir)[0]
serializer = ResultsSerializer(archive_base)
starttime = time.time()
(subject, body) = build_email_body(name, archive_dir)
try:
- if email:
+ if email and dry_run:
+ print "From: %s" % (config.results_sending_email or 'teuthology')
+ print "To: %s" % email
+ print "Subject: %s" % subject
+ print body
+ elif email:
email_results(
subject=subject,
- from_=config.results_sending_email or 'teuthology',
+ from_=(config.results_sending_email or 'teuthology'),
to=email,
body=body,
)