Commit 3fa3bb9a authored by Mattia Rizzolo's avatar Mattia Rizzolo

download: raise a more obvious errors if no mirrors can be found

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mapreri@ubuntu.com>
parent ab1b07ac
...@@ -66,12 +66,18 @@ class Downloads: ...@@ -66,12 +66,18 @@ class Downloads:
if self._cache is not None: if self._cache is not None:
self._mirrors = self._cache["mirrors"] self._mirrors = self._cache["mirrors"]
else: else:
self._mirrors = { self._mirrors = {}
distro: list(sorted(launchpad.get_cdimage_mirrors( for distro in self.config["mirrors"]["for"]:
found_mirrors = list(sorted(launchpad.get_cdimage_mirrors(
distro, self.config["mirrors"]["country"] distro, self.config["mirrors"]["country"]
))) for distro in self.config["mirrors"]["for"] )))
} if found_mirrors:
self._mirrors[distro] = found_mirrors
if not self._mirrors:
raise ValueError(
"No available mirrors found for %(for)s in %(country)s"
% self.config["mirrors"]
)
return self._mirrors return self._mirrors
@property @property
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment