From: Andrew Schoen Date: Thu, 13 Aug 2015 14:12:06 +0000 (-0500) Subject: task.ansible: catch failure log parse errors X-Git-Tag: 1.1.0~850^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4695ea0cd50d48bccc6e17cce037a2cc820245a9;p=teuthology.git task.ansible: catch failure log parse errors 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 --- diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index 046e364dc..c0712d589 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -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: