File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,12 @@ import subprocess
13
13
import sys
14
14
15
15
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
+ ]
16
22
17
23
18
24
class Section (object ):
@@ -63,10 +69,10 @@ def load_logdata_from_handle(handle):
63
69
current_test = match .group ('test' )
64
70
65
71
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 "
70
76
section = Section (' ' + match .group ('lineno' ) + ':' + match .group ('command' ), color = color )
71
77
else :
72
78
section = Section (match .group (1 ))
You can’t perform that action at this time.
0 commit comments