1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-08-25 09:49:53 +03:00

Select dc in one function call

This commit is contained in:
2019-12-04 23:17:27 +04:00
parent e31aac8bbc
commit ad6712a6de
2 changed files with 10 additions and 11 deletions

View File

@ -46,11 +46,7 @@ class gpoa_controller:
# Determine the default Samba DC for replication and try # Determine the default Samba DC for replication and try
# to overwrite it with user setting. # to overwrite it with user setting.
dc = None dc = util.select_dc(self.__lp, self.__creds, self.__args.dc)
try:
dc = util.select_dc(self.__lp, self.__creds, self.__args.dc)
except:
pass
username = self.__args.user username = self.__args.user
domain = util.get_domain_name(self.__lp, self.__creds, dc) domain = util.get_domain_name(self.__lp, self.__creds, dc)

View File

@ -32,13 +32,16 @@ def get_gpo_list(dc_hostname, creds, lp, user):
return gpos return gpos
def select_dc(lp, creds, dc): def select_dc(lp, creds, dc):
samba_dc = get_dc_hostname(creds, lp) try:
samba_dc = get_dc_hostname(creds, lp)
if samba_dc != dc and dc != None: if samba_dc != dc and dc != None:
logging.debug('Samba DC setting is {} and is overwritten by user setting {}'.format(samba_dc, dc)) logging.debug('Samba DC setting is {} and is overwritten by user setting {}'.format(samba_dc, dc))
return dc return dc
return samba_dc
return samba_dc except:
logging.error('Unable to determine DC hostname')
return None
def wbinfo_getsid(domain, user): def wbinfo_getsid(domain, user):
''' '''