Skip to content

Commit 64b78ea

Browse files
author
Vladimir Kotal
committed
fix errors introduced by refactoring
1 parent e20a5d8 commit 64b78ea

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/sync/commands.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,18 @@ def __init__(self, base):
7171
logging.basicConfig()
7272

7373
def run_command(self, command):
74+
"""
75+
Execute a command and return its return code.
76+
"""
7477
cmd = Command(command,
7578
args_subst={"PROJECT": self.name},
7679
args_append=[self.name], excl_subst=True)
7780
cmd.execute()
7881
self.retcodes[str(cmd)] = cmd.getretcode()
7982
self.outputs[str(cmd)] = cmd.getoutput()
8083

84+
return cmd.getretcode()
85+
8186
def call_rest_api(self, command):
8287
"""
8388
Make RESTful API call.
@@ -118,18 +123,17 @@ def run(self):
118123
if is_web_uri(command[0]):
119124
self.call_rest_api(command)
120125
else:
121-
self.run_command(command)
126+
retcode = self.run_command(command)
122127

123128
# If a command fails, terminate the sequence of commands.
124-
retcode = cmd.getretcode()
125129
if retcode != 0:
126130
if retcode == 2:
127131
self.logger.info("command '{}' requested break".
128-
format(cmd))
132+
format(command))
129133
self.run_cleanup()
130134
else:
131135
self.logger.info("command '{}' failed with code {}, "
132-
"breaking".format(cmd, retcode))
136+
"breaking".format(command, retcode))
133137
self.failed = True
134138
self.run_cleanup()
135139
break

0 commit comments

Comments
 (0)