Commit d582620e authored by shadMod's avatar shadMod 💬

added initial self._mirrors

fixed found_mirrors with 'https://releases.ubuntu.com/' if there's 'it1.mirror.vhosting-it.com'

(it's a quick fix, it will be fix when I make auto-compile.download.toml)
parent 5fb217d5
Pipeline #305 passed with stage
in 0 seconds
...@@ -37,6 +37,8 @@ CACHE_FILE_VERSION = 1 ...@@ -37,6 +37,8 @@ CACHE_FILE_VERSION = 1
class Downloads: class Downloads:
def __init__(self, data_path): def __init__(self, data_path):
# init _mirrors
self._mirrors = None
# Load the configuration # Load the configuration
path = UITWWW_DIR + CONFIG_FILE path = UITWWW_DIR + CONFIG_FILE
self.config = toml.load( self.config = toml.load(
...@@ -61,7 +63,7 @@ class Downloads: ...@@ -61,7 +63,7 @@ class Downloads:
@property @property
def mirrors(self): def mirrors(self):
"""Get a list of CD mirrors needed by the website""" """Get a list of CD mirrors needed by the website"""
if not hasattr(self, "_mirrors"): if not hasattr(self, "_mirrors") or self._mirrors is None:
if self._cache is not None: if self._cache is not None:
self._mirrors = self._cache["mirrors"] self._mirrors = self._cache["mirrors"]
else: else:
...@@ -70,6 +72,8 @@ class Downloads: ...@@ -70,6 +72,8 @@ class Downloads:
found_mirrors = list(sorted(launchpad.get_cdimage_mirrors( found_mirrors = list(sorted(launchpad.get_cdimage_mirrors(
distro, self.config["mirrors"]["country"] distro, self.config["mirrors"]["country"]
))) )))
if "it1.mirror.vhosting-it.com" in found_mirrors[0]:
found_mirrors = ["https://releases.ubuntu.com/"]
if found_mirrors: if found_mirrors:
self._mirrors[distro] = found_mirrors self._mirrors[distro] = found_mirrors
if not self._mirrors: if not self._mirrors:
......
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