mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-27 16:46:42 -06:00
Remove ipa-server-install LDAP update errors
python-ldap add_s method raises a NO_SUCH_OBJECT exception when a parent entry of the entry being added does not exist. This may not be an error, for example NIS entries are only added when NIS is enabled and thus the NIS entry container exists. The exception raised by python-ldap is also incorrectly processed in ipaldap's addEntry function and an irrelevant exception is re-raised instead. Fix LDAP updater to just log an information when an object cannot be added due to missing parent object. Also make sure that the addEntry function exception processing provides the right exception with a useful description. https://fedorahosted.org/freeipa/ticket/2520 https://fedorahosted.org/freeipa/ticket/2743
This commit is contained in:
parent
560f2ce8bd
commit
aa9ea477af
@ -649,7 +649,14 @@ class LDAPUpdate:
|
||||
# addifexist may result in an entry with only a
|
||||
# dn defined. In that case there is nothing to do.
|
||||
# It means the entry doesn't exist, so skip it.
|
||||
self.conn.addEntry(entry)
|
||||
try:
|
||||
self.conn.addEntry(entry)
|
||||
except errors.NotFound:
|
||||
# parent entry of the added entry does not exist
|
||||
# this may not be an error (e.g. entries in NIS container)
|
||||
root_logger.info("Parent DN of %s may not exist, cannot create the entry",
|
||||
entry.dn)
|
||||
return
|
||||
self.modified = True
|
||||
except Exception, e:
|
||||
root_logger.error("Add failure %s", e)
|
||||
|
@ -492,7 +492,7 @@ class IPAdmin(IPAEntryLDAPObject):
|
||||
self.set_option(ldap.OPT_SERVER_CONTROLS, sctrl)
|
||||
self.add_s(entry.dn, entry.toTupleList())
|
||||
except ldap.LDAPError, e:
|
||||
arg_desc = 'entry=%s' % (entry)
|
||||
arg_desc = 'entry=%s' % (entry.toTupleList())
|
||||
self.__handle_errors(e, arg_desc=arg_desc)
|
||||
return True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user