From e9fd7befb7817d3c9d580ee5a09292d4b3957716 Mon Sep 17 00:00:00 2001 From: Hugh Saunders Date: Wed, 28 Jan 2015 12:48:46 +0000 Subject: [PATCH] Retry apt cache updates --- packaging/os/apt.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packaging/os/apt.py b/packaging/os/apt.py index b768c62c6de..d1a844ad738 100644 --- a/packaging/os/apt.py +++ b/packaging/os/apt.py @@ -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()))