mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
Remove overlapping use-cases of the same result variable
This commit is contained in:
parent
3bb6d38308
commit
8c8da71ea3
@ -781,18 +781,18 @@ class TrustDomainInstance(object):
|
|||||||
ldap_uri = 'ldap://%s' % (result.pdc_dns_name)
|
ldap_uri = 'ldap://%s' % (result.pdc_dns_name)
|
||||||
conn = _ldap.initialize(ldap_uri)
|
conn = _ldap.initialize(ldap_uri)
|
||||||
conn.set_option(_ldap.OPT_SERVER_CONTROLS, [ExtendedDNControl()])
|
conn.set_option(_ldap.OPT_SERVER_CONTROLS, [ExtendedDNControl()])
|
||||||
result = None
|
search_result = None
|
||||||
try:
|
try:
|
||||||
(objtype, res) = conn.search_s('', _ldap.SCOPE_BASE)[0]
|
(objtype, res) = conn.search_s('', _ldap.SCOPE_BASE)[0]
|
||||||
result = res['defaultNamingContext'][0]
|
search_result = res['defaultNamingContext'][0]
|
||||||
self.info['dns_hostname'] = res['dnsHostName'][0]
|
self.info['dns_hostname'] = res['dnsHostName'][0]
|
||||||
except _ldap.LDAPError, e:
|
except _ldap.LDAPError, e:
|
||||||
root_logger.error(
|
root_logger.error(
|
||||||
"LDAP error when connecting to %(host)s: %(error)s" %
|
"LDAP error when connecting to %(host)s: %(error)s" %
|
||||||
dict(host=unicode(result.pdc_name), error=str(e)))
|
dict(host=unicode(result.pdc_name), error=str(e)))
|
||||||
|
|
||||||
if result:
|
if search_result:
|
||||||
self.info['sid'] = self.parse_naming_context(result)
|
self.info['sid'] = self.parse_naming_context(search_result)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def parse_naming_context(self, context):
|
def parse_naming_context(self, context):
|
||||||
|
Loading…
Reference in New Issue
Block a user