Skip to content

Commit

Permalink
Merge pull request #140 from thobrla/master
Browse files Browse the repository at this point in the history
Treat exceptions accessing GCE credential cache file as a cache miss
  • Loading branch information
cherba29 authored Jan 19, 2017
2 parents cb827e4 + b204d3a commit a8536ee
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apitools/base/py/credentials_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ def _CheckCacheFileForMatch(self, cache_filename, scopes):
if (creds['scopes'] in
(None, cached_creds['scopes'])):
scopes = cached_creds['scopes']
except KeyboardInterrupt:
raise
except: # pylint: disable=bare-except
# Treat exceptions as a cache miss.
pass
finally:
cache_file.unlock_and_close()
return scopes
Expand Down Expand Up @@ -331,6 +336,11 @@ def _WriteCacheFile(self, cache_filename, scopes):
# If it's not locked, the locking process will
# write the same data to the file, so just
# continue.
except KeyboardInterrupt:
raise
except: # pylint: disable=bare-except
# Treat exceptions as a cache miss.
pass
finally:
cache_file.unlock_and_close()

Expand Down

0 comments on commit a8536ee

Please sign in to comment.