Closed nstielau closed 10 years ago
Yeah.
That was exactly what dry-run was supposed to do. Run on production without any actual changes doing, to make sure it works as expected.
The script validates credentials and if that validation pass (or someone removes that), it expcets to be connected to the API and tracebacks... :)
Problem with running without any credentials is (if I'm reading the API doc correctly), that one needs access to the API to return "dry" REST requests it would execute. (It needs to list API ARecords to see the document record_id
to delete.)
The dry REST requests seems useful, so one can directly copy'n'paste it into console, in case it seems reasonable output.
But I could definitely see a room for adding other level of "dry-run" which would basicaly just print out failed checks and do not go into the DynDNS code at all. Running it in this mode against production wouldn't obviously test the DynDns communication code...
Also upon invalid credetials, this last line should go away..
Exception AttributeError: "'DynDns' object has no attribute 'rest_iface'" in <bound method DynDns.__del__ of <ddcheck.dyndns.DynDns object at 0x10427ced0>> ignored
Fixed the last line of output, when incorrect credetials passed...
Still had to do the rest.
Added --healthcheck-only
(-H
) option. It will not require any dyndns credentials, will not contact API in anyway.
It just does a healthcheck and prints out failed checkpoints.
(ddcheck){master ddcheck } ddcheck -e 500 --healthcheck-only http://getpantheon.com/test 2014-01-20 23:09:18,359 Starting new HTTP connection (1): 2a00:1450:400d:805::100e 2014-01-20 23:09:18,398 IPv6 support... off 2014-01-20 23:09:18,569 Starting new HTTP connection (1): 198.61.151.215 2014-01-20 23:09:18,874 getpantheon.com http://198.61.151.215/test hit -> 301 (OK)
And adding 301 as failed https code: (see the last line)
(ddcheck){master ddcheck } ddcheck -e 500,301 --healthcheck-only http://getpantheon.com/test 2014-01-20 23:09:24,749 Starting new HTTP connection (1): 2a00:1450:400d:805::100e 2014-01-20 23:09:24,782 IPv6 support... off 2014-01-20 23:09:24,952 Starting new HTTP connection (1): 198.61.151.215 2014-01-20 23:09:25,249 getpantheon.com http://198.61.151.215/test hit -> 301 (!!) 2014-01-20 23:09:25,249 Detected down: getpantheon.com 198.61.151.215
Does that work for you better? Closing. Feel free to reopen/comment.
I love the idea of dry-run mode. Ideally, dry-run mode would work without any valid Dyn creds at all. That way we could run this against production URLs and watch logging, and see what it was doing, even if it was just monitoring at first.
For me, attempting to run dry-run mode without valid creds first yielded:
After removing the response check on https://github.com/whiskybar/ddcheck/blob/master/ddcheck/dyndns.py#L62, the script would exit after the first check: