samba_dnsupdate: cmd._run doesn't have Exceptions
authorGarming Sam <garming@catalyst.net.nz>
Tue, 26 Jul 2016 21:40:09 +0000 (09:40 +1200)
committerGarming Sam <garming@samba.org>
Tue, 22 Nov 2016 01:10:16 +0000 (02:10 +0100)
It returns a return code of -1 instead.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/scripting/bin/samba_dnsupdate

index 16265f639fdfd3f63c2d12193da38384876839b2..d18d8bd1f1903fc994fb9ce729f38e940b042449 100755 (executable)
@@ -554,7 +554,13 @@ def call_samba_tool(d, op="add", zone=None):
         cmd = cmd_dns()
         if opts.verbose:
             print "Calling samba-tool dns %s -k no -P %s" % (op, args)
-        cmd._run("dns", op, "-k", "no", "-P", *args)
+        ret = cmd._run("dns", op, "-k", "no", "-P", *args)
+        if ret == -1:
+            if opts.fail_immediately:
+                sys.exit(1)
+            error_count = error_count + 1
+            if opts.verbose:
+                print("Failed 'samba-tool dns' based update: %s : %s" % (str(d), estr))
     except Exception, estr:
         raise
         if opts.fail_immediately: