better return report
[dyn-nsupdate.git] / server-scripts / update
index 02a52c315c898f107ed4fbc73835e53b026983ba..0e8234c36bbc68ae83b5dde168f0b3e3709cc550 100755 (executable)
@@ -38,10 +38,12 @@ if "password" not in form or "domain" not in form or ("ip" not in form and "ipv6
     print "Mandatory argument missing: You must supply all of 'password', 'domain' and at least either 'ip' or 'ipv6'"
     sys.exit()
 
-domain = str(form.getvalue("domain"))
-password = str(form.getvalue("password"))
-ip = str(form.getvalue("ip"))
-ipv6 = str(form.getvalue("ipv6"))
+domain = form.getfirst("domain")
+password = form.getfirst("password")
+ip = form.getfirst("ip")
+ipv6 = form.getfirst("ipv6")
+assert domain is not None and password is not None
+assert ip is not None or ipv6 is not None
 
 # run update program
 args = ["/var/lib/bind/dyn-nsupdate", "--domain", domain, "--password", password]
@@ -59,4 +61,9 @@ if p.returncode or stderr or stdout:
     if stdout: print stdout
     if stderr: print stderr
 else:
-    print "good",ip
+    print "good",
+    if ip is not None:
+        print ip,
+    if ipv6 is not None:
+        print ipv6,
+    print