File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -71,13 +71,18 @@ def __init__(self, base):
71
71
logging .basicConfig ()
72
72
73
73
def run_command (self , command ):
74
+ """
75
+ Execute a command and return its return code.
76
+ """
74
77
cmd = Command (command ,
75
78
args_subst = {"PROJECT" : self .name },
76
79
args_append = [self .name ], excl_subst = True )
77
80
cmd .execute ()
78
81
self .retcodes [str (cmd )] = cmd .getretcode ()
79
82
self .outputs [str (cmd )] = cmd .getoutput ()
80
83
84
+ return cmd .getretcode ()
85
+
81
86
def call_rest_api (self , command ):
82
87
"""
83
88
Make RESTful API call.
@@ -118,18 +123,17 @@ def run(self):
118
123
if is_web_uri (command [0 ]):
119
124
self .call_rest_api (command )
120
125
else :
121
- self .run_command (command )
126
+ retcode = self .run_command (command )
122
127
123
128
# If a command fails, terminate the sequence of commands.
124
- retcode = cmd .getretcode ()
125
129
if retcode != 0 :
126
130
if retcode == 2 :
127
131
self .logger .info ("command '{}' requested break" .
128
- format (cmd ))
132
+ format (command ))
129
133
self .run_cleanup ()
130
134
else :
131
135
self .logger .info ("command '{}' failed with code {}, "
132
- "breaking" .format (cmd , retcode ))
136
+ "breaking" .format (command , retcode ))
133
137
self .failed = True
134
138
self .run_cleanup ()
135
139
break
You can’t perform that action at this time.
0 commit comments