]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
ansible.FailureAnalyzer: Drop malformed records
authorZack Cerza <zack@redhat.com>
Fri, 14 Jul 2023 17:50:24 +0000 (11:50 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 14 Jul 2023 18:04:17 +0000 (12:04 -0600)
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 <zack@redhat.com>
teuthology/task/ansible.py

index aa605d2aab63f82fba07c523c881b9e726624c0d..ea0f9c594c363c9c36533e489add5c22111f9887 100644 (file)
@@ -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())