LdapClient: fix get_object_by_dn() and get_object_by_dn() methods when populate cache method return no objects
This commit is contained in:
parent
6e85515420
commit
b9ba720798
1 changed files with 12 additions and 0 deletions
|
@ -424,6 +424,12 @@ class LdapClient:
|
||||||
if not populate_cache_method:
|
if not populate_cache_method:
|
||||||
return False
|
return False
|
||||||
populate_cache_method()
|
populate_cache_method()
|
||||||
|
if type_name not in self._cached_objects:
|
||||||
|
if warn:
|
||||||
|
log.warning('No %s found in LDAP', type_name)
|
||||||
|
else:
|
||||||
|
log.debug('No %s found in LDAP', type_name)
|
||||||
|
return None
|
||||||
if dn not in self._cached_objects[type_name]:
|
if dn not in self._cached_objects[type_name]:
|
||||||
if warn:
|
if warn:
|
||||||
log.warning('No %s found with DN "%s"', type_name, dn)
|
log.warning('No %s found with DN "%s"', type_name, dn)
|
||||||
|
@ -443,6 +449,12 @@ class LdapClient:
|
||||||
if not populate_cache_method:
|
if not populate_cache_method:
|
||||||
return False
|
return False
|
||||||
populate_cache_method()
|
populate_cache_method()
|
||||||
|
if type_name not in self._cached_objects:
|
||||||
|
if warn:
|
||||||
|
log.warning('No %s found in LDAP', type_name)
|
||||||
|
else:
|
||||||
|
log.debug('No %s found in LDAP', type_name)
|
||||||
|
return None
|
||||||
matched = dict(
|
matched = dict(
|
||||||
(dn, obj)
|
(dn, obj)
|
||||||
for dn, obj in self._cached_objects[type_name].items()
|
for dn, obj in self._cached_objects[type_name].items()
|
||||||
|
|
Loading…
Reference in a new issue