diff --git a/dnsupdate.py b/dnsupdate.py index 3dccdaa..a3cbdda 100644 --- a/dnsupdate.py +++ b/dnsupdate.py @@ -130,7 +130,9 @@ def readcfg(msg, show=""): return msg else: if not os.path.exists(msg['cfgfile']): - msg['error'].append("No such file: %s" % msg['cfgfile']) + if show: + checkerror(msg, show="errors") + msg['error'].append("No such file; '%s'" % msg['cfgfile']) return msg cfgfile = open(msg['cfgfile'], 'r') @@ -229,7 +231,9 @@ def verify_ip(msg): ip = "" host = msg['hostname'] + "." + msg['domain'] try: - ans = dns.resolver.query(host, 'A') + res = dns.resolver.Resolver() + res.nameservers = [msg['nameserver']] + ans = res.query(host) for res in ans: ip = res.to_text() except dns.exception.Timeout: