Skip to content

Commit 1a84141

Browse files
committed
Prevent cache corruption from preventing the client from initializing
1 parent 7c0949e commit 1a84141

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

openshift/dynamic/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,11 @@ def __init_cache(self, refresh=False):
599599
self._cache = {}
600600
refresh = True
601601
else:
602-
with open(self.__cache_file, 'r') as f:
603-
self._cache = json.load(f, cls=cache_decoder(self.client))
602+
try:
603+
with open(self.__cache_file, 'r') as f:
604+
self._cache = json.load(f, cls=cache_decoder(self.client))
605+
except Exception:
606+
return self.__init_cache(refresh=True)
604607
self._load_server_info()
605608
self.discover()
606609

0 commit comments

Comments
 (0)