1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

samba_dnsupdate: Simplify logic and add more verbose debugging

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>
This commit is contained in:
Andrew Bartlett 2015-08-10 12:15:04 +12:00 committed by Garming Sam
parent 72d5fa79a0
commit b1ab37ec5b

View File

@ -134,7 +134,9 @@ def get_credentials(lp):
try: try:
creds.get_named_ccache(lp, ccachename) creds.get_named_ccache(lp, ccachename)
if opts.use_file is None: if opts.use_file is not None:
return
# Now confirm we can get a ticket to a DNS server # Now confirm we can get a ticket to a DNS server
ans = check_one_dns_name(sub_vars['DNSDOMAIN'] + '.', 'NS') ans = check_one_dns_name(sub_vars['DNSDOMAIN'] + '.', 'NS')
for i in range(len(ans)): for i in range(len(ans)):
@ -152,6 +154,9 @@ def get_credentials(lp):
server_to_client = "" server_to_client = ""
try: try:
(client_finished, client_to_server) = gensec_client.update(server_to_client) (client_finished, client_to_server) = gensec_client.update(server_to_client)
if opts.verbose:
print "Successfully obtained Kerberos ticket to DNS/%s as %s" \
% (target_hostname, creds.get_username())
return return
except RuntimeError: except RuntimeError:
# Only raise an exception if they all failed # Only raise an exception if they all failed
@ -754,10 +759,9 @@ else:
use_samba_tool = opts.use_samba_tool use_samba_tool = opts.use_samba_tool
use_nsupdate = opts.use_nsupdate use_nsupdate = opts.use_nsupdate
# get our krb5 creds # get our krb5 creds
if len(delete_list) != 0 or len(update_list) != 0: if len(delete_list) != 0 or len(update_list) != 0 and not opts.nocreds:
if not opts.nocreds:
try: try:
get_credentials(lp) creds = get_credentials(lp)
except RuntimeError as e: except RuntimeError as e:
ccachename = None ccachename = None