added docstring

This commit is contained in:
Thomas Waldmann 2013-09-29 02:00:15 +02:00
parent 0a297b04ee
commit 726a5696bd

View File

@ -21,6 +21,15 @@ class SameIpError(ValueError):
def update(fqdn, ipaddr, ttl=60): def update(fqdn, ipaddr, ttl=60):
"""
intelligent dns updater - first does a lookup on the master server to find
the current ip and only sends a dynamic update if we have a different ip.
:param fqdn: fully qualified domain name (str)
:param ipaddr: new ip address
:param ttl: time to live, default 60s (int)
:raises: SameIpError if new and old IP is the same
"""
af = dns.inet.af_for_address(ipaddr) af = dns.inet.af_for_address(ipaddr)
rdtype = 'A' if af == dns.inet.AF_INET else 'AAAA' rdtype = 'A' if af == dns.inet.AF_INET else 'AAAA'
try: try: