1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Retry apt cache updates

This commit is contained in:
Hugh Saunders 2015-01-28 12:48:46 +00:00 committed by Matt Clay
parent 3d415ac2da
commit 92ebeffd6c

View file

@ -706,7 +706,15 @@ def main():
updated_cache_time = int(time.mktime(mtimestamp.timetuple()))
if cache_valid is not True:
cache.update()
for retry in xrange(3):
try:
cache.update()
break
except apt.cache.FetchFailedException:
pass
else:
#out of retries, pass on the exception
raise
cache.open(progress=None)
updated_cache = True
updated_cache_time = int(time.mktime(now.timetuple()))