From 00d540ba4c9991bf1378a0baf9c8bfc918378d37 Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 19 Aug 2015 11:06:22 -0500 Subject: [PATCH] ansible: raise an AnsibleFailedError even when parsing fails If _handle_failures fails to parse the yaml in the ansible error log, it can still give the contents of the failure log to an AnsibleFailedError in it's unparsed form. I also changed the log.exception to log.error when an ParserError occurs as I think it was confusing some having that extra traceback in the log. Signed-off-by: Andrew Schoen --- teuthology/task/ansible.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index 7f6efaa9d..f95a7fef5 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -267,14 +267,12 @@ class Ansible(Task): try: failures = yaml.safe_load(fail_log) except yaml.parser.ParserError: - log.exception( + log.error( "Failed to parse ansible failure log: {0}".format( self.failure_log.name, ) ) - # archive the log anyway so we can see what tripped up - # the yaml parsing - self._archive_failures() + failures = fail_log if failures: self._archive_failures() -- 2.47.3