Skip to content

Commit

Permalink
Prevent cache corruption from preventing the client from initializing
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianvf committed Mar 18, 2019
1 parent 7c0949e commit 1a84141
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions openshift/dynamic/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,11 @@ def __init_cache(self, refresh=False):
self._cache = {}
refresh = True
else:
with open(self.__cache_file, 'r') as f:
self._cache = json.load(f, cls=cache_decoder(self.client))
try:
with open(self.__cache_file, 'r') as f:
self._cache = json.load(f, cls=cache_decoder(self.client))
except Exception:
return self.__init_cache(refresh=True)
self._load_server_info()
self.discover()

Expand Down

0 comments on commit 1a84141

Please sign in to comment.