summaryrefslogtreecommitdiff
path: root/bin
diff options
authorPMR <pmr@pmr-lander>2017-11-14 21:05:24 +0000
committerPMR <pmr@pmr-lander>2017-11-14 21:05:24 +0000
commited8b1d6fbd5a9b50cd0b43e4be189716ada3049d (patch)
tree967cd00b0d40402f3b50c3697d847fe0ffab322c /bin
parent36076482a0d11cdc9af6c94f9c61946ebea16748 (diff)
parent7dfd59de1ea5c75d4d96c33e31ade1198f65fa44 (diff)
Merge #333060 from ~bladernr/plainbox-provider-checkbox:1729080-retry-lxc-image-download
Diffstat (limited to 'bin')
-rwxr-xr-xbin/virtualization15
1 files changed, 10 insertions, 5 deletions
diff --git a/bin/virtualization b/bin/virtualization
index 17ab9b7..de001a1 100755
--- a/bin/virtualization
+++ b/bin/virtualization
@@ -638,20 +638,24 @@ class LXDTest(object):
cmd = 'lxc image import {} rootfs {} --alias {}'.format(
self.template_tarball, self.rootfs_tarball,
self.image_alias)
- if not self.run_command(cmd):
+ result = self.run_command(cmd)
+ if not result:
logging.error('Error encountered while attempting to '
'import images into LXD')
result = False
else:
logging.debug("No local image available, attempting to "
"import from default remote.")
+ retry = 2
cmd = 'lxc image copy {}{} local: --alias {}'.format(
self.default_remote, self.os_version, self.image_alias)
- if not self.run_command(cmd):
+ result = self.run_command(cmd)
+ while not result and retry > 0:
logging.error('Error encountered while attempting to '
'import images from default remote.')
- result = False
-
+ logging.error('Retrying up to {} times.'.format(retry))
+ result = self.run_command(cmd)
+ retry -= 1
return result
def download_images(self, url, filename):
@@ -695,7 +699,8 @@ class LXDTest(object):
"""
result = self.setup()
if not result:
- logging.warn("One or more setup stages failed.")
+ logging.error("One or more setup stages failed.")
+ return False
# Create container
logging.debug("Launching container")