diff options
author | Rob Crittenden <rcritten@redhat.com> | 2008-10-08 23:31:49 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2008-10-10 03:36:56 -0400 |
commit | 83bb41faebc0a61269f2869e9123166254fff5b3 (patch) | |
tree | cfb1e62a7e770c35d230ed778b5808a221234fcf /ipa_server/ipaldap.py | |
parent | 672c07566df8d838b46edb6b80ba73ade2a27d55 (diff) | |
download | freeipa.git-83bb41faebc0a61269f2869e9123166254fff5b3.tar.gz freeipa.git-83bb41faebc0a61269f2869e9123166254fff5b3.tar.xz freeipa.git-83bb41faebc0a61269f2869e9123166254fff5b3.zip |
Mechanism to convert from xmlrpclib.Fault to an IPAError exception
Include slew of new exceptions, not all of which are used yet
Diffstat (limited to 'ipa_server/ipaldap.py')
-rw-r--r-- | ipa_server/ipaldap.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ipa_server/ipaldap.py b/ipa_server/ipaldap.py index 7ee31465..a7604021 100644 --- a/ipa_server/ipaldap.py +++ b/ipa_server/ipaldap.py @@ -32,7 +32,7 @@ import ldap.sasl from ldap.controls import LDAPControl,DecodeControlTuples,EncodeControlTuples from ldap.ldapobject import SimpleLDAPObject from ipa_server import ipautil - +from ipalib import errors # Global variable to define SASL auth sasl_auth = ldap.sasl.sasl({},'GSSAPI') @@ -279,12 +279,12 @@ class IPAdmin(SimpleLDAPObject): res = self.search(*args) objtype, obj = self.result(res) except ldap.NO_SUCH_OBJECT, e: - raise e + raise errors.NotFound, notfound(args) except ldap.LDAPError, e: - raise e + raise errors.DatabaseError, e if not obj: - raise ldap.NO_SUCH_OBJECT + raise errors.NotFound, notfound(args) elif isinstance(obj,Entry): return obj @@ -308,7 +308,7 @@ class IPAdmin(SimpleLDAPObject): raise e if not obj: - raise ldap.NO_SUCH_OBJECT + raise errors.NotFound, notfound(args) entries = [] for s in obj: @@ -345,7 +345,7 @@ class IPAdmin(SimpleLDAPObject): raise e if not entries: - raise ldap.NO_SUCH_OBJECT + raise errors.NotFound, notfound(args) if partial == 1: counter = -1 @@ -408,10 +408,9 @@ class IPAdmin(SimpleLDAPObject): # it indicates the previous attribute was removed by another # update, making the oldentry stale. except ldap.NO_SUCH_ATTRIBUTE: - # FIXME: better error - raise SyntaxError("mid-air collision") + raise ipaldap.MidairCollision except ldap.LDAPError, e: - raise e + raise ipaldap.DatabaseError, e return True def generateModList(self, old_entry, new_entry): |