mirror of
https://git.launchpad.net/~ubuntu-qt-code/+git/calamares-settings-ubuntu
synced 2025-07-06 06:01:29 +00:00
Clean up automirror module
Summary: * Improve naming of variables * Add comments Test Plan: No test plan Reviewers: wxl, tsimonq2, kc2bez Reviewed By: wxl, tsimonq2, kc2bez Differential Revision: https://phab.lubuntu.me/D44
This commit is contained in:
parent
e647964386
commit
72240d9fa0
@ -108,13 +108,13 @@ def getcountrycode():
|
|||||||
if libcalamares.globalstorage.value("hasInternet"):
|
if libcalamares.globalstorage.value("hasInternet"):
|
||||||
geoipurl = libcalamares.job.configuration["geoip"]["url"]
|
geoipurl = libcalamares.job.configuration["geoip"]["url"]
|
||||||
try:
|
try:
|
||||||
with urllib.request.urlopen(geoipurl, timeout=75) as url:
|
with urllib.request.urlopen(geoipurl, timeout=75) as http_response:
|
||||||
localedata = json.loads(url.read().decode())
|
localedata = json.loads(http_response.read().decode())
|
||||||
except HTTPError as error:
|
except HTTPError as http_error:
|
||||||
logging.error("Data not retrieved because %s - URL: %s",
|
logging.http_error("Data not retrieved because %s - URL: %s",
|
||||||
error, geoipurl)
|
http_error, geoipurl)
|
||||||
except URLError as error:
|
except URLError as url_error:
|
||||||
if isinstance(error.reason, socket.timeout):
|
if isinstance(url_error.reason, socket.timeout):
|
||||||
logging.error("Socket timed out - URL %s", geoipurl)
|
logging.error("Socket timed out - URL %s", geoipurl)
|
||||||
else:
|
else:
|
||||||
logging.error("Non-timeout protocol error.")
|
logging.error("Non-timeout protocol error.")
|
||||||
@ -126,6 +126,9 @@ def getcountrycode():
|
|||||||
|
|
||||||
|
|
||||||
def get_subdomain_by_country(countrycode):
|
def get_subdomain_by_country(countrycode):
|
||||||
|
"""Return the subdomain for the given countrycode
|
||||||
|
or an empty string.
|
||||||
|
"""
|
||||||
if countrycode in SUBDOMAINS_BY_COUNTRY_CODE.keys():
|
if countrycode in SUBDOMAINS_BY_COUNTRY_CODE.keys():
|
||||||
return SUBDOMAINS_BY_COUNTRY_CODE[countrycode]
|
return SUBDOMAINS_BY_COUNTRY_CODE[countrycode]
|
||||||
else:
|
else:
|
||||||
@ -133,10 +136,12 @@ def get_subdomain_by_country(countrycode):
|
|||||||
|
|
||||||
|
|
||||||
def getcodename():
|
def getcodename():
|
||||||
|
"""Return the codename of the distribution, similar to lsb_release -cs"""
|
||||||
return get_distro_information()["CODENAME"]
|
return get_distro_information()["CODENAME"]
|
||||||
|
|
||||||
|
|
||||||
def changesources(subdomain):
|
def changesources(subdomain):
|
||||||
|
"""Replace the placeholders and then create the sources.list"""
|
||||||
distro = libcalamares.job.configuration["distribution"]
|
distro = libcalamares.job.configuration["distribution"]
|
||||||
url = "http://{}{}".format(subdomain,
|
url = "http://{}{}".format(subdomain,
|
||||||
libcalamares.job.configuration["baseUrl"])
|
libcalamares.job.configuration["baseUrl"])
|
||||||
|
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -1,3 +1,11 @@
|
|||||||
|
calamares-settings-ubuntu (1:19.10.6) eoan; urgency=medium
|
||||||
|
|
||||||
|
* Clean up automirror module:
|
||||||
|
- Improve naming of variables
|
||||||
|
- Add comments
|
||||||
|
|
||||||
|
-- apt-ghetto <apt-ghetto@lubuntu.me> Fri, 13 Sep 2019 16:51:05 +0200
|
||||||
|
|
||||||
calamares-settings-ubuntu (1:19.10.5) eoan; urgency=medium
|
calamares-settings-ubuntu (1:19.10.5) eoan; urgency=medium
|
||||||
|
|
||||||
* Fix UnboundLocalError in automirror module.
|
* Fix UnboundLocalError in automirror module.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user