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('-')
|
||||
tries = 20
|
||||
while True:
|
||||
ret = subprocess.run(loadargs, input=json.dumps(out), text=True, check=True)
|
||||
if ret.returncode:
|
||||
try:
|
||||
subprocess.run(loadargs, input=json.dumps(out), text=True, check=True)
|
||||
break
|
||||
except subprocess.CalledProcessError:
|
||||
if tries:
|
||||
print(f"loader failed! retrying ({tries} attempts remaining)")
|
||||
tries -= 1
|
||||
else:
|
||||
sys.exit("loader failed and all retries exhausted!")
|
||||
else:
|
||||
break
|
||||
|
||||
def main():
|
||||
"""Main loop."""
|
||||
|
Loading…
Reference in New Issue
Block a user