opscode/knife-google — pull request #31 by erjohnso (2014-03-21 21:56:07+00:00)
Title: Refresh access token

This fixes the issue where users would need to re-run 'knife google setup' after an hour had passed from the previous time they ran it. There was a bug where the the access token was not being refreshed.

This fix now catches 401, refreshes the access token, and saves that back to ~/.google-compute.json. I tested this over the period of a few hours and also with fresh 'knife google setup' commands.

It should be noted that I've discovered a bug where the user cannot use 'knife google setup -f my-custom-credentials-file'. The user preference is not being recorded properly and always falls back to using the default, ~/google-compute.json. However, since that was existing behavior, I opted not to try and fix that in this PR.

@paulrossman, @adamedx - I'd appreciate a review and quick test if you can. I've had two reports of this issue being problematic. I'll ask them to review this fix as well.