From: Zack Cerza Date: Fri, 14 Jul 2023 17:38:54 +0000 (-0600) Subject: Ansible._handle_failure: YAMLErrors are special X-Git-Tag: 1.2.0~90^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ad65ce07d4a0a5122fb0d5d7f8cbc1f6fc1dc95c;p=teuthology.git Ansible._handle_failure: YAMLErrors are special Return to treating them differently, but also continue to catch other exceptions here. Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index 1ff833135..aa605d2aa 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -376,12 +376,12 @@ class Ansible(Task): try: analyzer = FailureAnalyzer() failures = analyzer.analyze(fail_log) - except Exception as e: + except yaml.YAMLError as e: log.error( - "Failed to parse ansible failure log: {0} ({1})".format( - self.failure_log.name, e - ) + f"Failed to parse ansible failure log: {self.failure_log.name} ({e})" ) + except Exception: + log.exception(f"Failed to analyze ansible failure log: {self.failure_log.name}") # If we hit an exception, or if analyze() returned nothing, use the log as-is if not failures: failures = fail_log.replace('\n', '')