From: Zack Cerza Date: Fri, 14 Jul 2023 17:50:24 +0000 (-0600) Subject: ansible.FailureAnalyzer: Drop malformed records X-Git-Tag: 1.2.0~90^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1c413be82761863722fd2dabb91597ae7dac3f93;p=teuthology.git ansible.FailureAnalyzer: Drop malformed records If host_obj is the wrong type, we won't be able to extract anything useful from it. In these cases, we'll end up using the raw string as we used to do. Signed-off-by: Zack Cerza --- diff --git a/teuthology/task/ansible.py b/teuthology/task/ansible.py index aa605d2aa..ea0f9c594 100644 --- a/teuthology/task/ansible.py +++ b/teuthology/task/ansible.py @@ -44,6 +44,8 @@ class FailureAnalyzer: if failure_obj is None: return lines for host_obj in failure_obj.values(): + if not isinstance(host_obj, dict): + continue lines = lines.union(self.analyze_host_record(host_obj)) return lines @@ -57,7 +59,11 @@ class FailureAnalyzer: if "cpan" in cmd: lines.add(f"CPAN command failed: {cmd}") continue - lines_to_analyze = result.get("stderr_lines", result["msg"].split("\n")) + lines_to_analyze = [] + if "stderr_lines" in result: + lines_to_analyze = result["stderr_lines"] + elif "msg" in result: + lines_to_analyze = result["msg"].split("\n") lines_to_analyze.extend(result.get("err", "").split("\n")) for line in lines_to_analyze: line = self.analyze_line(line.strip())