Commit b52533eb authored by Andre Sailer's avatar Andre Sailer
Browse files

install_binary_tarfile: add retry loop for download

parent 0c635d40
Pipeline #3288930 passed with stage
in 7 minutes and 43 seconds
......@@ -36,19 +36,23 @@ def install_tarfile(urltarfile, prefix, lcgprefix, with_hash=True, with_link=Tru
sys.exit(1)
print('==== Downloading and installing %s' % urltarfile)
counter = 0
success = False
while counter < 5 and not success:
counter += 1
try:
resp = urllib2.urlopen(urltarfile)
tar = tarfile.open(fileobj=resp, mode='r|gz', errorlevel=1)
dirname, version = os.path.split(tar.next().name)
tar.extractall(path=prefix)
success = True
except urllib2.HTTPError as detail:
print('Error downloading %s : %s' % (urltarfile, detail))
sys.exit(1)
except tarfile.ReadError as detail:
print('Error untaring %s : %s' %(urltarfile, detail))
sys.exit(1)
except:
print('Unexpected error:', sys.exc_info()[0])
if not success:
sys.exit(1)
#---rename the version directory----------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment