openmicroscopy/snoopycrimecop — pull request #106 by sbesson (2013-10-03 13:11:42+00:00)
Title: Add a new CheckStatus command to retrieve Github API status

- Raise a Stop if the status is not good
- Add an option to display the last n status messages
- Add add_token_args() to the generic GithubCommand initialization

This PR was coded & tested during Oct 8 GH DDoS and thus hard to test in real conditions. Typical output is expected to look like:

```
(virtualenv)sebastien@sbesson:scc (api_status) $ python scc/main.py check-status || echo "error"
Github API state is minor as of 2013-10-03 11:23:52
error
(virtualenv)sebastien@sbesson:scc (api_status) $ python scc/main.py check-status -n 1
2013-10-03 11:15:26 (minor) Transit connectivity has been restored for some users. We are still actively mitigating a large attack.
Github API state is minor as of 2013-10-03 11:23:52
(virtualenv)sebastien@sbesson:scc (api_status) $ python scc/main.py check-status -n 10
2013-10-03 11:15:26 (minor) Transit connectivity has been restored for some users. We are still actively mitigating a large attack.
2013-10-03 10:48:43 (major) We're working to re-establish connectivity after the attack disrupted our primary internet transit links.
2013-10-03 10:20:58 (major) The site is unavailable as we continue mitigating a large DDoS attack.
2013-10-03 10:17:12 (minor) Service hook delivery is delayed and archived generation unavailable while the attack continues. We're simultaneously working on deflecting the attack and restoring affected services.
2013-10-03 09:43:40 (minor) We are recovering from a major service outage as we work to mitigate another DDoS attack.
2013-10-03 09:35:17 (major) The site is unavailable as we investigate issues reaching GitHub.com.
2013-10-02 22:17:13 (good) Everything operating normally.
2013-10-02 22:07:22 (minor) We are investigating issues with the GitHub API
2013-10-02 20:39:45 (good) The DDoS attack has stopped, and service should be back to normal. We're keeping a close eye on things to ensure we're able to quickly mitigate the attack if it returns.
Github API state is minor as of 2013-10-03 11:28:38
(virtualenv)sebastien@sbesson:scc (api_status) $ python scc/main.py check-status -n 10 && echo "passed"
2013-10-02 22:17:13 (good) Everything operating normally.
2013-10-03 09:35:17 (major) The site is unavailable as we investigate issues reaching GitHub.com.
2013-10-03 09:43:40 (minor) We are recovering from a major service outage as we work to mitigate another DDoS attack.
2013-10-03 10:17:12 (minor) Service hook delivery is delayed and archived generation unavailable while the attack continues. We're simultaneously working on deflecting the attack and restoring affected services.
2013-10-03 10:20:58 (major) The site is unavailable as we continue mitigating a large DDoS attack.
2013-10-03 10:48:43 (major) We're working to re-establish connectivity after the attack disrupted our primary internet transit links.
2013-10-03 11:15:26 (minor) Transit connectivity has been restored for some users. We are still actively mitigating a large attack.
2013-10-03 11:31:10 (minor) We've restored access to code downloads and queued service hooks are being delivered. The attack continues, but our mitigation is holding firm.
2013-10-03 12:35:15 (good) The attack has subsided and services have recovered. We're keeping mitigation in place to ensure we're able to quickly react if the attack returns.
passed

```