diff options
author | Martin Kosek <mkosek@redhat.com> | 2012-05-11 16:59:56 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-05-17 21:21:47 -0400 |
commit | aa9ea477af7be67d59f204af4e0da67fd8cfd862 (patch) | |
tree | 12072ceae169c23a7db2c24143900a30da7cf32a /ipaserver | |
parent | 560f2ce8bd0525189e45ff7d8f8d4df11f9c20ff (diff) | |
download | freeipa-aa9ea477af7be67d59f204af4e0da67fd8cfd862.tar.gz freeipa-aa9ea477af7be67d59f204af4e0da67fd8cfd862.tar.xz freeipa-aa9ea477af7be67d59f204af4e0da67fd8cfd862.zip |
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
Diffstat (limited to 'ipaserver')
-rw-r--r-- | ipaserver/install/ldapupdate.py | 9 | ||||
-rw-r--r-- | ipaserver/ipaldap.py | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py index e803df8a2..61a2ae19f 100644 --- a/ipaserver/install/ldapupdate.py +++ b/ipaserver/install/ldapupdate.py @@ -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) diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py index 23279aa0b..8b5451c73 100644 --- a/ipaserver/ipaldap.py +++ b/ipaserver/ipaldap.py @@ -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 |