Fix UnboundLocalError in automirror module

Summary: When opening an URL, an error may be raised and the wrong, not defined variable was logged.

Test Plan: Create an HTTPError or an URLError (socket.timeout), when opening "https://ipapi.co/json"

Reviewers: wxl, tsimonq2, kc2bez

Reviewed By: wxl, kc2bez

Differential Revision: https://phab.lubuntu.me/D42
ubuntu/focal ubuntu/1%19.10.5
apt-ghetto 5 years ago committed by Walter Lapchynski
parent cd7fa92d15
commit e647964386

@ -112,10 +112,10 @@ def getcountrycode():
localedata = json.loads(url.read().decode()) localedata = json.loads(url.read().decode())
except HTTPError as error: except HTTPError as error:
logging.error("Data not retrieved because %s - URL: %s", logging.error("Data not retrieved because %s - URL: %s",
error, url) error, geoipurl)
except URLError as error: except URLError as error:
if isinstance(error.reason, socket.timeout): if isinstance(error.reason, socket.timeout):
logging.error("Socket timed out - URL %s", url) logging.error("Socket timed out - URL %s", geoipurl)
else: else:
logging.error("Non-timeout protocol error.") logging.error("Non-timeout protocol error.")
else: else:

6
debian/changelog vendored

@ -1,3 +1,9 @@
calamares-settings-ubuntu (1:19.10.5) eoan; urgency=medium
* Fix UnboundLocalError in automirror module.
-- apt-ghetto <apt-ghetto@lubuntu.me> Sun, 08 Sep 2019 11:17:17 +0200
calamares-settings-ubuntu (1:19.10.4) eoan; urgency=medium calamares-settings-ubuntu (1:19.10.4) eoan; urgency=medium
[ Dan Simmons ] [ Dan Simmons ]

Loading…
Cancel
Save