Skip to content

Commit 6a67953

Browse files
committed
Don't highlight some command "failures" in osg-test-log-viewer
`systemctl is-active` and `system ... status` are expected to fail half the time.
1 parent 8899b64 commit 6a67953

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

osg-test-log-viewer

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ import subprocess
1313
import sys
1414

1515

16+
OK_FAIL_COMMAND_PATTERNS = [
17+
# These commands don't get highlighted if they return nonzero
18+
"rpm --query",
19+
"systemctl is-active",
20+
r"service\s+\S+\s+status"
21+
]
1622

1723

1824
class Section(object):
@@ -63,10 +69,10 @@ def load_logdata_from_handle(handle):
6369
current_test = match.group('test')
6470

6571
retcode, _, _ = match.group('result').split()
66-
if int(retcode) != 0 and 'rpm --query' not in match.group('command'):
67-
color = "red"
68-
else:
69-
color = "black"
72+
color = "black"
73+
if int(retcode) != 0:
74+
if not any(re.search(pattern, match.group('command')) for pattern in OK_FAIL_COMMAND_PATTERNS):
75+
color = "red"
7076
section = Section(' ' + match.group('lineno') + ':' + match.group('command'), color=color)
7177
else:
7278
section = Section(match.group(1))

0 commit comments

Comments
 (0)