From c0ce0a556a6db0ac3ba7369383308c16a6cab41f Mon Sep 17 00:00:00 2001 From: j Date: Mon, 22 Feb 2016 19:52:55 +0530 Subject: [PATCH] get_latest_release might fail if network is down --- oml/update.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/oml/update.py b/oml/update.py index 35025da..76d9bf0 100644 --- a/oml/update.py +++ b/oml/update.py @@ -96,13 +96,16 @@ def current_version(module): return version def get_latest_release(): - release_data = get(settings.server.get('release_url')) - release = json.loads(release_data.decode('utf-8')) - if verify(release): - ox.makedirs(settings.updates_path) - with open(os.path.join(settings.updates_path, 'release.json'), 'wb') as fd: - fd.write(release_data) - return release + try: + release_data = get(settings.server.get('release_url')) + release = json.loads(release_data.decode('utf-8')) + if verify(release): + ox.makedirs(settings.updates_path) + with open(os.path.join(settings.updates_path, 'release.json'), 'wb') as fd: + fd.write(release_data) + return release + except: + logger.debug('failed get latest release') def get_platform(): name = sys.platform