1
0
mirror of https://github.com/altlinux/gpupdate.git synced 2025-03-21 18:50:38 +03:00

Get domain name in one function call

This commit is contained in:
Игорь Чудов 2019-12-04 23:15:13 +04:00
parent 38ddee2e8a
commit e31aac8bbc
Signed by untrusted user: nir
GPG Key ID: 0F3883600CAE7AAC
2 changed files with 10 additions and 10 deletions

View File

@ -53,11 +53,7 @@ class gpoa_controller:
pass
username = self.__args.user
domain = None
try:
domain = util.get_domain_name(self.__lp, self.__creds, dc)
except:
pass
domain = util.get_domain_name(self.__lp, self.__creds, dc)
sid = util.get_sid(domain, username)

View File

@ -93,12 +93,16 @@ def get_domain_name(lp, creds, dc):
'''
Get current Active Directory domain name
'''
# Get CLDAP record about domain
# Look and python/samba/netcmd/domain.py for more examples
res = netcmd_get_domain_infos_via_cldap(lp, None, dc)
logging.info('Found domain via CLDAP: {}'.format(res.dns_domain))
try:
# Get CLDAP record about domain
# Look and python/samba/netcmd/domain.py for more examples
res = netcmd_get_domain_infos_via_cldap(lp, None, dc)
logging.info('Found domain via CLDAP: {}'.format(res.dns_domain))
return res.dns_domain
return res.dns_domain
except:
logging.error('Unable to retrieve domain name via CLDAP query')
return None
def traverse_dir(root_dir):
filelist = []