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 | |
parent | 672c07566df8d838b46edb6b80ba73ade2a27d55 (diff) | |
download | freeipa-83bb41faebc0a61269f2869e9123166254fff5b3.tar.gz freeipa-83bb41faebc0a61269f2869e9123166254fff5b3.tar.xz freeipa-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')
-rw-r--r-- | ipa_server/ipaldap.py | 17 | ||||
-rw-r--r-- | ipa_server/servercore.py | 3 |
2 files changed, 10 insertions, 10 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): diff --git a/ipa_server/servercore.py b/ipa_server/servercore.py index a391c5cf..d842a8c7 100644 --- a/ipa_server/servercore.py +++ b/ipa_server/servercore.py @@ -22,6 +22,7 @@ import string import re from ipa_server.context import context import ipautil +from ipalib import errors # temporary import krbV @@ -335,6 +336,6 @@ def get_ipa_config(): config = get_sub_entry("cn=etc," + basedn, searchfilter) except ldap.NO_SUCH_OBJECT, e: # FIXME - raise e + raise errors.NotFound return config |