samba_dnsupdate: Simplify logic and add more verbose debugging
authorAndrew Bartlett <abartlet@samba.org>
Mon, 10 Aug 2015 00:15:04 +0000 (12:15 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 15 Dec 2015 07:42:20 +0000 (08:42 +0100)
By reducing the intendation this code is a little clearer

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

index c6769b6ad58942691d83cddf10a883a8e31dc56b..e34d148154d460203f1becdb98435092c3bbcd10 100755 (executable)
@@ -110,9 +110,7 @@ if opts.verbose:
 def get_credentials(lp):
     """# get credentials if we haven't got them already."""
     from samba import credentials
-    global ccachename, creds
-    if creds is not None:
-        return
+    global ccachename
     creds = credentials.Credentials()
     creds.guess(lp)
     creds.set_machine_account(lp)
@@ -623,6 +621,9 @@ if len(delete_list) == 0 and len(update_list) == 0 and not rebuild_cache:
     if opts.verbose:
         print "No DNS updates needed"
     sys.exit(0)
+else:
+    if opts.verbose:
+        print "%d DNS updates and %d DNS deletes needed" % (len(update_list), len(delete_list))
 
 # get our krb5 creds
 if len(delete_list) != 0 or len(update_list) != 0: