1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +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
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC
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
# to overwrite it with user setting.
dc = None
try:
dc = util.select_dc(self.__lp, self.__creds, self.__args.dc)
except:
pass
dc = util.select_dc(self.__lp, self.__creds, self.__args.dc)
username = self.__args.user
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
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:
logging.debug('Samba DC setting is {} and is overwritten by user setting {}'.format(samba_dc, dc))
return dc
return samba_dc
if samba_dc != dc and dc != None:
logging.debug('Samba DC setting is {} and is overwritten by user setting {}'.format(samba_dc, dc))
return dc
return samba_dc
except:
logging.error('Unable to determine DC hostname')
return None
def wbinfo_getsid(domain, user):
'''