Speling: nameserver is name server
This commit is contained in:
17
dnsupdate.py
17
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user