Add a retry loop to fifloader

load_templates often fails for no good reason - see
https://progress.opensuse.org/issues/121378 . This makes
fifloader retry 20 times on failure to mitigate the issue.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2023-12-04 10:18:47 -08:00
parent 309ccc45ee
commit 2c476fded6
1 changed files with 11 additions and 1 deletions

View File

@ -340,7 +340,17 @@ def run(args):
if args.update:
loadargs.append('--update')
loadargs.append('-')
subprocess.run(loadargs, input=json.dumps(out), text=True, check=True)
tries = 20
while True:
ret = subprocess.run(loadargs, input=json.dumps(out), text=True, check=True)
if ret.returncode:
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."""