diff options
author | Rob Crittenden <rcritten@redhat.com> | 2009-02-25 13:50:43 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-27 12:57:21 -0500 |
commit | 3fdf9abfce71e0d32f6fc8e5a3b699b663fc5ead (patch) | |
tree | 6f541f3dfebfd4e9e7d14a44b28600b556df92b7 /ipaserver/ipaldap.py | |
parent | af0c0c309dc506b7642f94a9dfcc8359b47f077d (diff) | |
download | freeipa-3fdf9abfce71e0d32f6fc8e5a3b699b663fc5ead.tar.gz freeipa-3fdf9abfce71e0d32f6fc8e5a3b699b663fc5ead.tar.xz freeipa-3fdf9abfce71e0d32f6fc8e5a3b699b663fc5ead.zip |
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
Diffstat (limited to 'ipaserver/ipaldap.py')
-rw-r--r-- | ipaserver/ipaldap.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py index a490c3407..af17988be 100644 --- a/ipaserver/ipaldap.py +++ b/ipaserver/ipaldap.py @@ -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 |