]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
ansible.FailureAnalyzer: Look for SSH errors
authorZack Cerza <zack@redhat.com>
Fri, 14 Jul 2023 17:37:33 +0000 (11:37 -0600)
committerZack Cerza <zack@redhat.com>
Fri, 14 Jul 2023 18:04:17 +0000 (12:04 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/ansible.py
teuthology/test/task/test_ansible.py

index 331c9b792828cf7342a3e9efa5e34decdbedbc09..1ff833135bdfd842675533851f79f2b3e4abd011 100644 (file)
@@ -58,23 +58,36 @@ class FailureAnalyzer:
                 lines.add(f"CPAN command failed: {cmd}")
                 continue
             lines_to_analyze = result.get("stderr_lines", result["msg"].split("\n"))
+            lines_to_analyze.extend(result.get("err", "").split("\n"))
             for line in lines_to_analyze:
-                line = self.analyze_line(line)
+                line = self.analyze_line(line.strip())
                 if line:
                     lines.add(line)
         return list(lines)
 
     def analyze_line(self, line):
-        # apt output sometimes contains warnings or suggestions. Those won't be
-        # helpful, so throw them out.
         if line.startswith("W: ") or line.endswith("?"):
             return ""
+        drop_phrases = [
+            # apt output sometimes contains warnings or suggestions. Those won't be
+            # helpful, so throw them out.
+            r"^W: ",
+            r"\?$",
+            # some output from SSH is not useful
+            r"Warning: Permanently added .+ to the list of known hosts.",
+            r"^@+$",
+        ]
+        for phrase in drop_phrases:
+            match = re.search(rf"({phrase})", line, flags=re.IGNORECASE)
+            if match:
+                return ""
 
         # Next, we can normalize some common phrases.
         phrases = [
             "connection timed out",
             r"(unable to|could not) connect to [^ ]+",
             r"temporary failure resolving [^ ]+",
+            r"Permissions \d+ for '.+' are too open.",
         ]
         for phrase in phrases:
             match = re.search(rf"({phrase})", line, flags=re.IGNORECASE)
index 939ec3f938d63b0ba05a1b0f98e6cd4ca5e84568..a4a086700e5b40409b7c790e2bac21bd04bde4d4 100644 (file)
@@ -34,6 +34,14 @@ class TestFailureAnalyzer:
                 "E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libb/libb-hooks-op-check-perl/libb-hooks-op-check-perl_0.22-1build2_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'",
                 "Temporary failure resolving 'archive.ubuntu.com'"
             ],
+            [
+                "Data could not be sent to remote host \"smithi068.front.sepia.ceph.com\".",
+                "Data could not be sent to remote host \"smithi068.front.sepia.ceph.com\"."
+            ],
+            [
+                "Permissions 0644 for '/root/.ssh/id_rsa' are too open.",
+                "Permissions 0644 for '/root/.ssh/id_rsa' are too open."
+            ],
         ]
     )
     def test_lines(self, line, result):