From aeecde32ed3ba00cb1cfe582018d2a07f2f7ccf9 Mon Sep 17 00:00:00 2001 From: Joe Talbott Date: Wed, 4 Feb 2015 16:13:32 -0500 Subject: [PATCH 1/2] 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 = [] From 7adfb13783c512a65f25357225c2a1fdca65ec2d Mon Sep 17 00:00:00 2001 From: Joe Talbott Date: Wed, 4 Feb 2015 16:25:36 -0500 Subject: [PATCH 2/2] boottest - Add error message if fetching the manifest fails --- boottest.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boottest.py b/boottest.py index 51f0aa5..1ae180e 100644 --- a/boottest.py +++ b/boottest.py @@ -61,6 +61,9 @@ class TouchManifest(object): while retries > 0 and not success: success = self.__fetch_manifest(distribution, series) retries -= 1 + if not success: + print("E: [%s] - Unable to fetch manifest: %s %s" % ( + time.asctime(), distribution, series)) self._manifest = self._load()