From: Michael Tremer Date: Wed, 1 Nov 2017 21:00:37 +0000 (+0100) Subject: Softly fail when mirrorlist is not in cache X-Git-Tag: 0.9.28~1285^2~1330 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ce84b7dd3b86179215d6fa74c7f1b691db49871;p=pakfire.git Softly fail when mirrorlist is not in cache Signed-off-by: Michael Tremer --- diff --git a/src/pakfire/repository/remote.py b/src/pakfire/repository/remote.py index b7e29f802..f7c1b3974 100644 --- a/src/pakfire/repository/remote.py +++ b/src/pakfire/repository/remote.py @@ -125,10 +125,16 @@ class RepositoryRemote(base.RepositoryFactory): """ Opens a cached mirror list """ - with self.cache_open("mirrors", "r") as f: - mirrors = json.load(f) + try: + with self.cache_open("mirrors", "r") as f: + mirrors = json.load(f) - return mirrors.get("mirrors") + return mirrors.get("mirrors") + + # If there is no mirror list in the cache, + # we won't be able to open it + except IOError: + pass return []