Robust gam use

51 views
Skip to first unread message

Bri Hatch

unread,
Nov 27, 2016, 11:17:20 PM11/27/16
to google-ap...@googlegroups.com
1) oauth concurrency

Gam updates the oauth json file - is this done in an atomic way, or is there a risk of race conditions?

I'm asking because we have some automated processes that have occasional errors, and I'm wondering if it could be because more than one 'gam' is running at a time, from the same dir, and one may stomp on the json before the other has a chance to read it.

If the new json were written to a temp file and then 'os.rename'd on top of the original then there's no risk of race condition. Not sure where the code is that updates this file.

2) exit statuses

Which gam commands are written in a way that we can rely on the exit status being accurate? In the unix world, an exit of '0' means success, and anything else (1->255) means failure. Last time I went through the code there were a lot of places that exited cleanly even on error, or would exit with an HTTP status code. These would become nonsensical because python mod 256's them, thus a 404 would become a 148.

Happy to audit the code again to see where exists are not accurate, but thought I'd ask first.


--
Bri Hatch, Systems and Security Engineer. http://www.ifokr.org/bri/

The sooner you fall behind, the more time you'll have to catch up.

Reply all
Reply to author
Forward
0 new messages