From 4695ea0cd50d48bccc6e17cce037a2cc820245a9 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Thu, 13 Aug 2015 09:12:06 -0500 Subject: [PATCH] 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 --- teuthology/task/ansible.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: -- 2.47.3