From 1c413be82761863722fd2dabb91597ae7dac3f93 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 14 Jul 2023 11:50:24 -0600 Subject: [PATCH] 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 --- teuthology/task/ansible.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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()) -- 2.47.3