mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Enforce netgroup uniqueness, allow netgroups to be members of netgroups
When adding an entry, convert a constraint violation of "already exists" into a DuplicateEntry exception so the user gets a useful response
This commit is contained in:
@@ -381,6 +381,12 @@ class IPAdmin(SimpleLDAPObject):
|
||||
self.add_s(*args)
|
||||
except ldap.ALREADY_EXISTS, e:
|
||||
raise errors2.DuplicateEntry
|
||||
except ldap.CONSTRAINT_VIOLATION, e:
|
||||
# This error gets thrown by the uniqueness plugin
|
||||
if e.args[0].get('info','') == 'Another entry with the same attribute value already exists':
|
||||
raise errors2.DuplicateEntry
|
||||
else:
|
||||
raise errors.DatabaseError, e
|
||||
except ldap.LDAPError, e:
|
||||
raise errors.DatabaseError, e
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user