get_latest_release might fail if network is down

This commit is contained in:
j 2016-02-22 19:52:55 +05:30
parent ed8e71e5c6
commit c0ce0a556a

View file

@ -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