]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology/scrape.py: Remove empty string and space in _get_service_types wip-ksirivad-fix-62534 1889/head
authorKamoltat Sirivadhna <ksirivad@redhat.com>
Wed, 6 Sep 2023 15:16:37 +0000 (11:16 -0400)
committerKamoltat Sirivadhna <ksirivad@redhat.com>
Fri, 8 Sep 2023 18:25:45 +0000 (14:25 -0400)
Problem:

the function grep returns a list contianing empty string which
results in scrape.py throwing the warning "Misunderstood line: ".

Solution:

filter out empty strings, blank space and None
before getting match with regex.

Fixes: https://tracker.ceph.com/issues/62534
Signed-off-by: Kamoltat Sirivadhna <ksirivad@redhat.com>
teuthology/scrape.py

index 92e52f32219eae553e265f042a62e845dc629167..42caf3a4a0d6c75006bc748c20ff377d65bf4782 100644 (file)
@@ -410,7 +410,10 @@ class ValgrindReason(Reason):
         result = defaultdict(list)
         # Lines like:
         # 2014-08-22T20:07:18.668 ERROR:tasks.ceph:saw valgrind issue   <kind>Leak_DefinitelyLost</kind> in /var/log/ceph/valgrind/osd.3.log.gz
-        for line in grep(os.path.join(job.path, "teuthology.log"), "</kind> in "):
+        valgrind_err_line = grep(os.path.join(job.path, "teuthology.log"), "</kind> in ")
+        # removes blank space, empty string and None
+        valgrind_err_line = [line for line in valgrind_err_line if line and line.strip()]
+        for line in valgrind_err_line:
             match = re.search("<kind>(.+)</kind> in .+/(.+)", line)
             if not match:
                 log.warning("Misunderstood line: {0}".format(line))