]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
task.ansible: catch failure log parse errors
authorAndrew Schoen <aschoen@redhat.com>
Thu, 13 Aug 2015 14:12:06 +0000 (09:12 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 13 Aug 2015 14:12:06 +0000 (09:12 -0500)
If we fail to parse a failure log, fail silently and log the exception
so that we can inspect that log after the fact.

In this case a CommandFailedError will be raised.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
teuthology/task/ansible.py

index 046e364dcb833f99c47b496475f2faeda6d0bb84..c0712d589083e4555b57e97be00e9e82c10d7d08 100644 (file)
@@ -263,7 +263,10 @@ class Ansible(Task):
     def _handle_failure(self, command, status):
         failures = None
         with open(self.failure_log.name, 'r') as log:
-            failures = yaml.safe_load(log)
+            try:
+                failures = yaml.safe_load(log)
+            except yaml.parser.ParserError:
+                log.exception("Failed to load failure log...")
 
         if failures:
             if self.ctx.archive: