whiskybar / ddcheck

Ping sites and adjust DynDNS for those up/down.
0 stars 0 forks source link

Better errors if the checked host is not managed by Dyn #7

Closed nstielau closed 10 years ago

nstielau commented 10 years ago

If the checked host is not managed by dyn, it should print out a nice messages saying so and exit unsuccessfully.

The current behavior is:

○ → ddcheck -e 500 --debug --dry-run http://dev.nuclearrooster.com/test
2014-01-17 16:05:59,959 Resolving http://dev.nuclearrooster.com/test
Traceback (most recent call last):
  File "/usr/local/bin/ddcheck", line 9, in <module>
    load_entry_point('ddcheck==0.0.1', 'console_scripts', 'ddcheck')()
  File "/usr/local/lib/python2.7/site-packages/ddcheck/console.py", line 59, in main
    healthcheck(options.urls, error_codes=error_codes, timeout=options.timeout, dry_run=options.dry_run, dyndns_credentials=dyndns_credentials)
  File "/usr/local/lib/python2.7/site-packages/ddcheck/server.py", line 40, in healthcheck
    checkpoints = resolve_ips(urls) #TODO: green this?
  File "/usr/local/lib/python2.7/site-packages/ddcheck/resolver.py", line 26, in resolve_ips
    answer = _dig(netloc, record_type, nameservers=nameservers)
  File "/usr/local/lib/python2.7/site-packages/ddcheck/resolver.py", line 17, in _dig
    return resolver.query(qname, rdtype)
  File "/usr/local/lib/python2.7/site-packages/dns/resolver.py", line 817, in query
    raise NoNameservers
dns.resolver.NoNameservers
aleszoulek commented 10 years ago

Yep. The resolver is now generic. But the DynDns API should check if the Zone exists in the account and (if not) error out nicely.

aleszoulek commented 10 years ago

This one is fixed.

ddcheck -e 500,301 --debug --dry-run http://getpantheon.com/test 2014-01-21 21:34:03,854 ddcheck: [DEBUG] Digging google.com AAAA None 2014-01-21 21:34:03,902 ddcheck: [INFO] Starting new HTTP connection (1): 2a00:1450:400d:802::1002 2014-01-21 21:34:03,941 ddcheck: [INFO] IPv6 support... off 2014-01-21 21:34:05,336 ddcheck: [DEBUG] Resolving http://getpantheon.com/test 2014-01-21 21:34:05,337 ddcheck: [DEBUG] Digging getpantheon.com NS None 2014-01-21 21:34:05,369 ddcheck: [DEBUG] Using nameservers: ns1.p30.dynect.net., ns2.p30.dynect.net., ns3.p30.dynect.net., ns4.p30.dynect.net. 2014-01-21 21:34:05,369 ddcheck: [DEBUG] Digging getpantheon.com A ['ns1.p30.dynect.net.', 'ns2.p30.dynect.net.', 'ns3.p30.dynect.net.', 'ns4.p30.dynect.net.'] 2014-01-21 21:34:05,526 ddcheck: [DEBUG] Found health check point: checkpoint(url='http://198.61.151.215/test', host='getpantheon.com', record='getpantheon.com.', ip='198.61.151.215', type='A') 2014-01-21 21:34:05,529 ddcheck: [INFO] Starting new HTTP connection (1): 198.61.151.215 2014-01-21 21:34:05,844 ddcheck: [DEBUG] "GET /test HTTP/1.1" 301 0 2014-01-21 21:34:05,845 ddcheck: [INFO] getpantheon.com http://198.61.151.215/test hit -> 301 (!!) 2014-01-21 21:34:06,982 ddcheck: [ERROR] Zone getpantheon.com is not managed by this DynDns account

But for your particular example, there's other issue blocking it. #12

Closing this one.