Fixed bug: Some exceptions were not caught.
[toast/tdyndns.git] / bin / nsupdate_dyndns
index 604da6bab77629d86e3bee427dfc319389cc86cc..49ed3e3b01ce1af8d0fd88e95c3cc0f291d22219 100755 (executable)
@@ -29,8 +29,11 @@ def nsupdate_delete(hostname, domain, ip_family):
 
 def main(args):
        if args.delete:
-               nsupdate_delete(args.hostname, args.domain, 'A')
-               nsupdate_delete(args.hostname, args.domain, 'AAAA')
+               if args.ip is None:
+                       nsupdate_delete(args.hostname, args.domain, 'A')
+                       nsupdate_delete(args.hostname, args.domain, 'AAAA')
+               else:
+                       nsupdate_delete(args.hostname, args.domain, ipfamily_by_ip(args.ip))
        else:
                nsupdate_delete(args.hostname, args.domain, ipfamily_by_ip(args.ip))
                nsupdate_add(args.hostname, args.domain, args.ttl, args.ip)