From aeecde32ed3ba00cb1cfe582018d2a07f2f7ccf9 Mon Sep 17 00:00:00 2001 From: Joe Talbott Date: Wed, 4 Feb 2015 16:13:32 -0500 Subject: [PATCH] boottest - Add retry loop (3) for manifest fetching --- boottest.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/boottest.py b/boottest.py index 254e8e0..51f0aa5 100644 --- a/boottest.py +++ b/boottest.py @@ -27,6 +27,9 @@ import apt_pkg from consts import BINARIES +FETCH_RETRIES = 3 + + class TouchManifest(object): """Parses a corresponding touch image manifest. @@ -52,14 +55,19 @@ class TouchManifest(object): self.path = "boottest/images/{}/{}/manifest".format( distribution, series) if fetch: - self.__fetch_manifest(distribution, series) + retries = FETCH_RETRIES + success = self.__fetch_manifest(distribution, series) + + while retries > 0 and not success: + success = self.__fetch_manifest(distribution, series) + retries -= 1 + self._manifest = self._load() def __fetch_manifest(self, distribution, series): - url = "http://cdimage.ubuntu.com/{}/daily-preinstalled/" \ - "pending/{}-preinstalled-touch-armhf.manifest".format( - distribution, series - ) + url = "http://cdimage.ubuntu.com/ubuntu-touch/daily-preinstalled/" \ + "pending/{}-preinstalled-touch-armhf.manifest".format(series) + success = False if self.verbose: print( "I: [%s] - Fetching manifest from %s" % ( @@ -71,6 +79,9 @@ class TouchManifest(object): os.makedirs(os.path.dirname(self.path)) with open(self.path, 'w') as fp: fp.write(response.read()) + success = True + + return success def _load(self): pkg_list = []