diff --git a/boottest.py b/boottest.py index 74e3552..87d122c 100644 --- a/boottest.py +++ b/boottest.py @@ -69,22 +69,33 @@ class TouchManifest(object): self._manifest = self._load() def __fetch_manifest(self, project, series): - url = "http://cdimage.ubuntu.com/{}/daily-preinstalled/" \ - "pending/{}-preinstalled-touch-armhf.manifest".format( - project, series - ) + # There are two url formats that may lead to the proper manifest + # file. The first form is for series that have been released, + # the second form is for the current development series. + # Only one of these is expected to exist for any given series. + url_list = [ + "http://cdimage.ubuntu.com/{}/{}/daily-preinstalled/pending/" \ + "{}-preinstalled-touch-armhf.manifest".format( + project, series, series), + "http://cdimage.ubuntu.com/{}/daily-preinstalled/pending/" \ + "{}-preinstalled-touch-armhf.manifest".format( + project, series), + ] + success = False - if self.verbose: - print( - "I: [%s] - Fetching manifest from %s" % ( - time.asctime(), url)) - print("I: [%s] - saving it to %s" % (time.asctime(), self.path)) - try: - response = urllib.urlopen(url) - except IOError as e: - print("W: [%s] - error connecting to %s: %s" % ( - time.asctime(), self.path, e)) - return success # failure + for url in url_list: + if self.verbose: + print("I: [%s] - Fetching manifest from %s" % + (time.asctime(), url)) + print("I: [%s] - saving it to %s" % + (time.asctime(), self.path)) + try: + response = urllib.urlopen(url) + if response.code == 200: + break + except IOError as e: + print("W: [%s] - error connecting to %s: %s" % ( + time.asctime(), self.path, e)) # Only [re]create the manifest file if one was successfully downloaded # this allows for an existing image to be used if the download fails.