Merge ~bladernr/plainbox-provider-checkbox:1729080-retry-lxc-image-download into plainbox-provider-checkbox:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Jeff Lane 
Approved revision: 7dfd59de1ea5c75d4d96c33e31ade1198f65fa44
Merged at revision: ed8b1d6fbd5a9b50cd0b43e4be189716ada3049d
Proposed branch: ~bladernr/plainbox-provider-checkbox:1729080-retry-lxc-image-download
Merge into: plainbox-provider-checkbox:master
Diff against target: 43 lines (+10/-5)
1 file modified
bin/virtualization (+10/-5)
Reviewer Review Type Date Requested Status
Jeff Lane  Approve
Review via email: mp+333060@code.launchpad.net

Description of the change

bin/virtualization: test now retries importing LXC images up to 3 times from web, rather than only once. Also, if any setup step fails, the test is aborted rather than continuing on.

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

No comment after 2 weeks. Self approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/virtualization b/bin/virtualization
2index 17ab9b7..de001a1 100755
3--- a/bin/virtualization
4+++ b/bin/virtualization
5@@ -638,20 +638,24 @@ class LXDTest(object):
6 cmd = 'lxc image import {} rootfs {} --alias {}'.format(
7 self.template_tarball, self.rootfs_tarball,
8 self.image_alias)
9- if not self.run_command(cmd):
10+ result = self.run_command(cmd)
11+ if not result:
12 logging.error('Error encountered while attempting to '
13 'import images into LXD')
14 result = False
15 else:
16 logging.debug("No local image available, attempting to "
17 "import from default remote.")
18+ retry = 2
19 cmd = 'lxc image copy {}{} local: --alias {}'.format(
20 self.default_remote, self.os_version, self.image_alias)
21- if not self.run_command(cmd):
22+ result = self.run_command(cmd)
23+ while not result and retry > 0:
24 logging.error('Error encountered while attempting to '
25 'import images from default remote.')
26- result = False
27-
28+ logging.error('Retrying up to {} times.'.format(retry))
29+ result = self.run_command(cmd)
30+ retry -= 1
31 return result
32
33 def download_images(self, url, filename):
34@@ -695,7 +699,8 @@ class LXDTest(object):
35 """
36 result = self.setup()
37 if not result:
38- logging.warn("One or more setup stages failed.")
39+ logging.error("One or more setup stages failed.")
40+ return False
41
42 # Create container
43 logging.debug("Launching container")

Subscribers

People subscribed via source and target branches