From 589a895608145d4ddd4b0af8673ae2071ec3a117 Mon Sep 17 00:00:00 2001
From: Kamoltat Sirivadhna <ksirivad@redhat.com>
Date: Wed, 6 Sep 2023 11:16:37 -0400
Subject: [PATCH] teuthology/scrape.py: Remove empty string in
 _get_service_types

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 before getting match with regex.

Fixes: https://tracker.ceph.com/issues/62534

Signed-off-by: Kamoltat Sirivadhna <ksirivad@redhat.com>
---
 teuthology/scrape.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/teuthology/scrape.py b/teuthology/scrape.py
index 92e52f322..1dc35d894 100644
--- a/teuthology/scrape.py
+++ b/teuthology/scrape.py
@@ -410,7 +410,9 @@ def _get_service_types(self, job):
         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 ")
+        valgrind_err_line = list(filter(None, valgrind_err_line))
+        for line in valgrind_err_line:
             match = re.search("<kind>(.+)</kind> in .+/(.+)", line)
             if not match:
                 log.warning("Misunderstood line: {0}".format(line))