Skip to content

Commit

Permalink
teuthology/scrape.py: Remove empty string in _get_service_types
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
kamoltat committed Sep 7, 2023
1 parent 54e62bc commit fb5d5f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion teuthology/scrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,10 @@ 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)) # remove empty strings
valgrind_err_line = [line for line in valgrind_err_line if line.strip()] # remove blank space
for line in valgrind_err_line:
match = re.search("<kind>(.+)</kind> in .+/(.+)", line)
if not match:
log.warning("Misunderstood line: {0}".format(line))
Expand Down

0 comments on commit fb5d5f5

Please sign in to comment.