commit eea1227c2aa304cfcceb9de2a836026a6f646ff2
parent 7cf5d7bcfcdd7760d212226fa7a939903774dcde
Author: parazyd <parazyd@dyne.org>
Date: Mon, 24 Jul 2017 11:41:43 +0200
handle requests.exceptions.ConnectionError when grabbing remote Release
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/amprolla_update.py b/amprolla_update.py
@@ -11,11 +11,11 @@ from time import time
import requests
import lib.globalvars as globalvars
-from amprolla_merge import gen_release, merge, prepare_merge_dict
from lib.config import aliases, cpunm, repos, repo_order, spooldir
-from lib.log import info
+from lib.log import info, warn
from lib.parse import compare_dict, get_date, get_time, parse_release
from lib.net import download
+from amprolla_merge import gen_release, merge, prepare_merge_dict
def remote_is_newer(remote, local):
@@ -55,7 +55,11 @@ def perform_update(suite, paths):
if paths[c]:
info('Working on %s repo' % i)
remote_path = paths[c].replace(spooldir, repos[i]['host'])
- remote_rel = requests.get(join(remote_path, 'Release'))
+ try:
+ remote_rel = requests.get(join(remote_path, 'Release'))
+ except requests.exceptions.ConnectionError as err:
+ warn('Caught exception: "%s". Retrying...' % err)
+ return perform_update(suite, paths)
local_rel_text = open(join(paths[c], 'Release')).read()