mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-05-18 22:11:30 +00:00
boottest - Add retry loop (3) for manifest fetching
This commit is contained in:
parent
82b1c1cd83
commit
aeecde32ed
21
boottest.py
21
boottest.py
@ -27,6 +27,9 @@ import apt_pkg
|
|||||||
from consts import BINARIES
|
from consts import BINARIES
|
||||||
|
|
||||||
|
|
||||||
|
FETCH_RETRIES = 3
|
||||||
|
|
||||||
|
|
||||||
class TouchManifest(object):
|
class TouchManifest(object):
|
||||||
"""Parses a corresponding touch image manifest.
|
"""Parses a corresponding touch image manifest.
|
||||||
|
|
||||||
@ -52,14 +55,19 @@ class TouchManifest(object):
|
|||||||
self.path = "boottest/images/{}/{}/manifest".format(
|
self.path = "boottest/images/{}/{}/manifest".format(
|
||||||
distribution, series)
|
distribution, series)
|
||||||
if fetch:
|
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()
|
self._manifest = self._load()
|
||||||
|
|
||||||
def __fetch_manifest(self, distribution, series):
|
def __fetch_manifest(self, distribution, series):
|
||||||
url = "http://cdimage.ubuntu.com/{}/daily-preinstalled/" \
|
url = "http://cdimage.ubuntu.com/ubuntu-touch/daily-preinstalled/" \
|
||||||
"pending/{}-preinstalled-touch-armhf.manifest".format(
|
"pending/{}-preinstalled-touch-armhf.manifest".format(series)
|
||||||
distribution, series
|
success = False
|
||||||
)
|
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print(
|
print(
|
||||||
"I: [%s] - Fetching manifest from %s" % (
|
"I: [%s] - Fetching manifest from %s" % (
|
||||||
@ -71,6 +79,9 @@ class TouchManifest(object):
|
|||||||
os.makedirs(os.path.dirname(self.path))
|
os.makedirs(os.path.dirname(self.path))
|
||||||
with open(self.path, 'w') as fp:
|
with open(self.path, 'w') as fp:
|
||||||
fp.write(response.read())
|
fp.write(response.read())
|
||||||
|
success = True
|
||||||
|
|
||||||
|
return success
|
||||||
|
|
||||||
def _load(self):
|
def _load(self):
|
||||||
pkg_list = []
|
pkg_list = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user