From: Andrew Schoen Date: Wed, 19 Aug 2015 16:06:22 +0000 (-0500) Subject: ansible: raise an AnsibleFailedError even when parsing fails X-Git-Tag: 1.1.0~843^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=00d540ba4c9991bf1378a0baf9c8bfc918378d37;p=teuthology.git 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 --- diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index 7f6efaa9..f95a7fef 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()