mirror of
https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git
synced 2024-11-21 13:33:08 +00:00
Fix the retry logic in fifloader.py
subprocess.run raises an exception by default if the command fails, you don't have to look for the return code. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
04e9f84338
commit
f7a337db9e
@ -342,15 +342,15 @@ def run(args):
|
|||||||
loadargs.append('-')
|
loadargs.append('-')
|
||||||
tries = 20
|
tries = 20
|
||||||
while True:
|
while True:
|
||||||
ret = subprocess.run(loadargs, input=json.dumps(out), text=True, check=True)
|
try:
|
||||||
if ret.returncode:
|
subprocess.run(loadargs, input=json.dumps(out), text=True, check=True)
|
||||||
|
break
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
if tries:
|
if tries:
|
||||||
print(f"loader failed! retrying ({tries} attempts remaining)")
|
print(f"loader failed! retrying ({tries} attempts remaining)")
|
||||||
tries -= 1
|
tries -= 1
|
||||||
else:
|
else:
|
||||||
sys.exit("loader failed and all retries exhausted!")
|
sys.exit("loader failed and all retries exhausted!")
|
||||||
else:
|
|
||||||
break
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Main loop."""
|
"""Main loop."""
|
||||||
|
Loading…
Reference in New Issue
Block a user