mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Handle races in replica config
When multiple replicas are installed in parallel, two replicas may try to create the cn=replica entry at the same time. This leads to a conflict on one of the replicas. replica_config() and ensure_replication_managers() now handle conflicts. ipaldap now maps TYPE_OR_VALUE_EXISTS to DuplicateEntry(). The type or value exists exception is raised, when an attribute value or type is already set. Fixes: https://pagure.io/freeipa/issue/7566 Signed-off-by: Christian Heimes <cheimes@redhat.com> Reviewed-By: Thierry Bordaz <tbordaz@redhat.com>
This commit is contained in:
@@ -1029,7 +1029,12 @@ class LDAPClient(object):
|
||||
except ldap.NO_SUCH_OBJECT:
|
||||
raise errors.NotFound(reason=arg_desc or 'no such entry')
|
||||
except ldap.ALREADY_EXISTS:
|
||||
# entry already exists
|
||||
raise errors.DuplicateEntry()
|
||||
except ldap.TYPE_OR_VALUE_EXISTS:
|
||||
# attribute type or attribute value already exists, usually only
|
||||
# occurs, when two machines try to write at the same time.
|
||||
raise errors.DuplicateEntry(message=desc)
|
||||
except ldap.CONSTRAINT_VIOLATION:
|
||||
# This error gets thrown by the uniqueness plugin
|
||||
_msg = 'Another entry with the same attribute value already exists'
|
||||
|
Reference in New Issue
Block a user