Skip to content

Commit 9b8cae4

Browse files
vladakVladimir Kotal
authored andcommitted
return error indication from check()
1 parent 1a0628f commit 9b8cae4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tools/sync/commands.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,11 @@ def run_cleanup(self):
115115
def check(self, ignore_errors):
116116
"""
117117
Check the output of the commands and perform logging.
118+
119+
Return 0 on success, 1 if error was detected.
118120
"""
119121

122+
ret = 0
120123
self.logger.debug("Output from {}:".format(self.name))
121124
for cmd in self.outputs.keys():
122125
if self.outputs[cmd] and len(self.outputs[cmd]) > 0:
@@ -129,6 +132,7 @@ def check(self, ignore_errors):
129132
return
130133

131134
if any(rv != 0 and rv != 2 for rv in self.retcodes.values()):
135+
ret = 1
132136
self.logger.error("processing of {} failed".
133137
format(self))
134138
indent = " "
@@ -148,6 +152,7 @@ def check(self, ignore_errors):
148152
errored_cmds = {k: v for k, v in self.outputs.items()
149153
if "error" in str(v).lower()}
150154
if len(errored_cmds) > 0:
155+
ret = 1
151156
self.logger.error("Command output in selfect {}"
152157
" contains errors:".format(self.name))
153158
indent = " "
@@ -158,3 +163,5 @@ def check(self, ignore_errors):
158163
if out:
159164
self.logger.error(out)
160165
self.logger.error("")
166+
167+
return ret

0 commit comments

Comments
 (0)