From ad65ce07d4a0a5122fb0d5d7f8cbc1f6fc1dc95c Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 14 Jul 2023 11:38:54 -0600 Subject: [PATCH] Ansible._handle_failure: YAMLErrors are special Return to treating them differently, but also continue to catch other exceptions here. Signed-off-by: Zack Cerza --- teuthology/task/ansible.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index 1ff833135b..aa605d2aab 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', '') -- 2.39.5