Skip to content

Treat exceptions accessing GCE credential cache file as a cache miss#140

Merged
cherba merged 2 commits intogoogle:masterfrom
thobrla:master
Jan 19, 2017
Merged

Treat exceptions accessing GCE credential cache file as a cache miss#140
cherba merged 2 commits intogoogle:masterfrom
thobrla:master

Conversation

@thobrla
Copy link
Contributor

@thobrla thobrla commented Jan 18, 2017

This fixes an issue where problems accessing the cache file on
the filesystem (for example, in a container with no mounted
filesystem) would cause apitools to abort entirely, as opposed to
simply not caching the credentials.

Fixes #139

This fixes an issue where problems accessing the cache file on
the filesystem (for example, in a container with no mounted
filesystem) would cause apitools to abort entirely, as opposed to
simply not caching the credentials.

Fixes google#139
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.04%) to 87.547% when pulling 3cfaf2c on thobrla:master into cb827e4 on google:master.

if (creds['scopes'] in
(None, cached_creds['scopes'])):
scopes = cached_creds['scopes']
except: # pylint: disable=bare-except
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not possible to list specific exceptions we care to skip. This would also supress Ctrl-C.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, do you have any other suggestions beyond KeyboardInterrupt?

# If it's not locked, the locking process will
# write the same data to the file, so just
# continue.
except: # pylint: disable=bare-except
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care to add any unit tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would require mocking locked_file which was removed from more recent versions of oauth2client; this code is simple enough that I'd prefer not to unless you object.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 87.509% when pulling b204d3a on thobrla:master into cb827e4 on google:master.

@cherba cherba merged commit a8536ee into google:master Jan 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn instead of fail on GCE cache file access errors

5 participants