copr-be-dev: at least warn that we re-try the virt-install command

This commit is contained in:
Pavel Raiskup 2022-05-17 07:55:25 +02:00
parent 11352fa70e
commit c792f32ad2

View file

@ -311,12 +311,14 @@ class LibvirtSpawner:
"""
Retry command till it succeeds
"""
if not exception_message:
exception_message = "Command failed"
for _ in range(attempts):
if not self.call(cmd, stdout=sys.stderr):
return
self.log.warning("%s, retry after %s", exception_message,
sleep_seconds)
time.sleep(sleep_seconds)
if not exception_message:
exception_message = "Command failed"
exception_message += f" ({str(cmd)}, attempts={attempts})"
raise Exception(exception_message)