]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Indent wrapped exceptions.
authorZack Cerza <zack@cerza.org>
Wed, 28 Aug 2013 16:12:10 +0000 (11:12 -0500)
committerZack Cerza <zack@cerza.org>
Wed, 28 Aug 2013 16:12:10 +0000 (11:12 -0500)
teuthology/suite.py

index 8cb740172c5bb36ed9181461b96bbbd9357dda04..e15a25f687b4656a9e12552afbd6b0cedad7eb14 100644 (file)
@@ -469,11 +469,18 @@ def build_email_body(name, archive_dir, timeout):
             else:
                 sentry_line = ''
 
+            # 'fill' is from the textwrap module and it collapses a given
+            # string into multiple lines of a maximum width as specified. We
+            # want 75 characters here so that when we indent by 4 on the next
+            # line, we have 79-character exception paragraphs.
+            reason = fill(summary.get('failure_reason'), 75)
+            reason = '\n'.join(('    ') + line for line in reason.splitlines())
+
             failed[job] = email_templates['fail_templ'].format(
                 job_id=job,
                 desc=summary.get('description'),
                 time=int(summary.get('duration')),
-                reason=fill(summary.get('failure_reason'), 79),
+                reason=reason,
                 log_line=log_line,
                 sentry_line=sentry_line,
             )