From c7ebbf4ce796dba0256d94004e9d32c0cedaef27 Mon Sep 17 00:00:00 2001 From: Fredrik Wahlberg Date: Sun, 25 Jan 2004 22:21:32 +0000 Subject: [PATCH] Speling: nameserver is name server --- dnsupdate.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dnsupdate.py b/dnsupdate.py index 7b8defb..dcbbd1d 100644 --- a/dnsupdate.py +++ b/dnsupdate.py @@ -43,7 +43,7 @@ def getparams(msg): help="Alternate config file") parser.add_option("--delete", action="store_true", - help="Remove the host from the nameserver") + help="Remove the host from the name server") parser.add_option("-d", "--domain", type="string", help="Domain to update") @@ -61,7 +61,7 @@ def getparams(msg): help="Hostname to publish") parser.add_option("--nameserver", type="string", - help="IP-address to the nameserver") + help="IP-address to the name server") parser.add_option("-q", "--quiet", action="store_true", help="Quit mode") @@ -159,8 +159,10 @@ def update(msg): import dns.query import dns.tsigkeyring import dns.update - # The name of the key and the secret - import binascii # for exception handling + import binascii # for exception handling in keyring generation + import socket # for exception handling in server communictions + + # The name of the key and the secret try: keyring = dns.tsigkeyring.from_text({ msg['keyname']: msg['keysecret'] @@ -179,7 +181,6 @@ def update(msg): update.replace(msg['hostname'], msg['ttl'], 'a', msg['ipaddress']) # doit, servername - import socket # Import socket so we can catch exceptions try: response = dns.query.tcp(update, msg['nameserver']) except socket.error: @@ -237,14 +238,14 @@ def verify_ip(msg): for res in ans: ip = res.to_text() except dns.exception.Timeout: - msg['error'].append("Connection timeout, could not connect to nameserver.\n") + msg['error'].append("Connection timeout, could not connect to name server.\n") except dns.resolver.NXDOMAIN: pass if ip == msg['ipaddress'] and not msg.has_key('delete'): - msg['error'].append("Nameserver already up to date") + msg['error'].append("name server already up to date") elif ip == "" and msg.has_key('delete'): - msg['error'].append("Nameserver does not recognise the hostname") + msg['error'].append("name server does not recognise the hostname") return msg