summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipalib/errors.py2
-rw-r--r--ipalib/plugins/aci.py10
-rw-r--r--ipalib/plugins/automount.py6
-rw-r--r--ipalib/plugins/dns2.py2
-rw-r--r--ipalib/plugins/user.py2
-rw-r--r--ipalib/plugins/user2.py2
-rw-r--r--ipaserver/ipaldap.py8
-rw-r--r--ipaserver/servercore.py12
8 files changed, 22 insertions, 22 deletions
diff --git a/ipalib/errors.py b/ipalib/errors.py
index 2e9eebeef..a29dbbee6 100644
--- a/ipalib/errors.py
+++ b/ipalib/errors.py
@@ -739,7 +739,7 @@ class NotFound(ExecutionError):
"""
errno = 4001
- format = _('entry not found')
+ format = _('%(reason)r')
class DuplicateEntry(ExecutionError):
"""
diff --git a/ipalib/plugins/aci.py b/ipalib/plugins/aci.py
index cccd5cc37..5e1eb0dba 100644
--- a/ipalib/plugins/aci.py
+++ b/ipalib/plugins/aci.py
@@ -81,7 +81,7 @@ def search_by_name(acis, aciname):
# FIXME: need to log syntax errors, ignore for now
pass
- raise errors.NotFound()
+ raise errors.NotFound(reason="Unable to find aci %s" % aciname)
def search_by_attr(acis, attrlist):
"""
@@ -105,7 +105,7 @@ def search_by_attr(acis, attrlist):
if results:
return results
- raise errors.NotFound()
+ raise errors.NotFound(reason="Unable to find any ACIs with attribute %s" % ",".join(attrlist))
def search_by_taskgroup(acis, tgdn):
"""
@@ -126,7 +126,7 @@ def search_by_taskgroup(acis, tgdn):
if results:
return results
- raise errors.NotFound()
+ raise errors.NotFound(reason="taskgroup %s not found" % tgdn)
def search_by_perm(acis, permlist):
"""
@@ -148,7 +148,7 @@ def search_by_perm(acis, permlist):
if results:
return results
- raise errors.NotFound()
+ raise errors.NotFound(reason="No ACIs with permissions %s found" % ",".join(permlist))
def search_by_memberof(acis, memberoffilter):
"""
@@ -174,7 +174,7 @@ def search_by_memberof(acis, memberoffilter):
if results:
return results
- raise errors.NotFound()
+ raise errors.NotFound(reason="Nothing found for %s" % memberoffilter)
class aci(Object):
"""
diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py
index 6378a1385..705941874 100644
--- a/ipalib/plugins/automount.py
+++ b/ipalib/plugins/automount.py
@@ -291,7 +291,7 @@ class automount_delkey(crud.Del):
keydn = k.get('dn')
break
if not keydn:
- raise errors.NotFound(msg='Entry not found')
+ raise errors.NotFound(reason='Removing keys failed. key %s not found' % keyname)
return ldap.delete(keydn)
def output_for_cli(self, textui, result, *args, **options):
"""
@@ -369,7 +369,7 @@ class automount_modkey(crud.Mod):
keydn = k.get('dn')
break
if not keydn:
- raise errors.NotFound(msg='Entry not found')
+ raise errors.NotFound(reason='Update failed, unable to find key %s' % keyname)
return ldap.update(keydn, **kw)
def output_for_cli(self, textui, result, *args, **options):
@@ -517,7 +517,7 @@ class automount_showkey(crud.Get):
keydn = k.get('dn')
break
if not keydn:
- raise errors.NotFound(msg='Entry not found')
+ raise errors.NotFound(reason='Unable to find key %s' % keyname)
# FIXME: should kw contain the list of attributes to display?
if kw.get('all', False):
return ldap.retrieve(keydn)
diff --git a/ipalib/plugins/dns2.py b/ipalib/plugins/dns2.py
index b478a5bcb..35f9b698d 100644
--- a/ipalib/plugins/dns2.py
+++ b/ipalib/plugins/dns2.py
@@ -597,7 +597,7 @@ class dns2_del_rr(Command):
try:
attr_value.remove(data)
except ValueError:
- raise errors.NotFound(message=u'resource record not found')
+ raise errors.NotFound(reason=u'resource record not found')
# check if it's worth to keep this entry in LDAP
if 'idnsZone' not in entry_attrs['objectclass']:
diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
index b14136d12..6fad325f4 100644
--- a/ipalib/plugins/user.py
+++ b/ipalib/plugins/user.py
@@ -160,7 +160,7 @@ class user_add(crud.Create):
kw['gidnumber'] = default_group.get('gidnumber')
except errors.NotFound:
# Fake an LDAP error so we can return something useful to the kw
- raise errors.NotFound("The default group for new users, '%s', cannot be found." % config.get('ipadefaultprimarygroup'))
+ raise errors.NotFound(reason="The default group for new users, '%s', cannot be found." % config.get('ipadefaultprimarygroup'))
except Exception, e:
# catch everything else
raise e
diff --git a/ipalib/plugins/user2.py b/ipalib/plugins/user2.py
index e65fe1d80..7fb6b0ff0 100644
--- a/ipalib/plugins/user2.py
+++ b/ipalib/plugins/user2.py
@@ -148,7 +148,7 @@ class user2_create(crud.Create):
(group_dn, group_attrs) = ldap.get_entry(group_dn, ['gidNumber'])
except errors.NotFound:
error_msg = 'Default group for new users not found.'
- raise errors.NotFound(error_msg)
+ raise errors.NotFound(reason=error_msg)
# fill default group's gidNumber
entry_attrs['gidnumber'] = group_attrs['gidNumber']
diff --git a/ipaserver/ipaldap.py b/ipaserver/ipaldap.py
index c80cda428..d60e23fd6 100644
--- a/ipaserver/ipaldap.py
+++ b/ipaserver/ipaldap.py
@@ -298,7 +298,7 @@ class IPAdmin(SimpleLDAPObject):
raise e
except ldap.NO_SUCH_OBJECT, e:
args = kw.get('args', '')
- raise errors.NotFound(msg=notfound(args))
+ raise errors.NotFound(reason=notfound(args))
except ldap.ALREADY_EXISTS, e:
raise errors.DuplicateEntry()
except ldap.CONSTRAINT_VIOLATION, e:
@@ -361,7 +361,7 @@ class IPAdmin(SimpleLDAPObject):
self.__handle_errors(e, **kw)
if not obj:
- raise errors.NotFound(msg=notfound(args))
+ raise errors.NotFound(reason=notfound(args))
elif isinstance(obj,Entry):
return obj
@@ -383,7 +383,7 @@ class IPAdmin(SimpleLDAPObject):
self.__handle_errors(e, **kw)
if not obj:
- raise errors.NotFound(msg=notfound(args))
+ raise errors.NotFound(reason=notfound(args))
entries = []
for s in obj:
@@ -421,7 +421,7 @@ class IPAdmin(SimpleLDAPObject):
self.__handle_errors(e, **kw)
if not entries:
- raise errors.NotFound(msg=notfound(args))
+ raise errors.NotFound(reason=notfound(args))
if partial == 1:
counter = -1
diff --git a/ipaserver/servercore.py b/ipaserver/servercore.py
index 1e0972d7b..74014c758 100644
--- a/ipaserver/servercore.py
+++ b/ipaserver/servercore.py
@@ -270,7 +270,7 @@ def search(base, filter, attributes, timelimit=1, sizelimit=3000, scope=ldap.SCO
results = context.ldap.conn.getListAsync(base, scope,
filter, attributes, 0, None, None, timelimit, sizelimit)
except ldap.NO_SUCH_OBJECT:
- raise errors.NotFound()
+ raise errors.NotFound(reason=filter)
counter = results[0]
entries = [counter]
@@ -315,9 +315,9 @@ def get_ipa_config():
searchfilter = "cn=ipaconfig"
try:
config = get_sub_entry("cn=etc," + api.env.basedn, searchfilter)
- except ldap.NO_SUCH_OBJECT, e:
+ except ldap.NO_SUCH_OBJECT:
# FIXME
- raise errors.NotFound()
+ raise errors.NotFound(reason="IPA configuration cannot be loaded")
return config
@@ -409,12 +409,12 @@ def add_member_to_group(member_dn, group_dn, memberattr='member'):
group = get_entry_by_dn(group_dn, None)
if group is None:
- raise errors.NotFound()
+ raise errors.NotFound(reason="cannot find group %s" % group_dn)
# check to make sure member_dn exists
member_entry = get_base_entry(member_dn, "(objectClass=*)", ['dn','objectclass'])
if not member_entry:
- raise errors.NotFound()
+ raise errors.NotFound(reason="cannot find member %s" % member_dn)
# Add the new member to the group member attribute
members = group.get(memberattr, [])
@@ -430,7 +430,7 @@ def remove_member_from_group(member_dn, group_dn, memberattr='member'):
group = get_entry_by_dn(group_dn, None)
if group is None:
- raise errors.NotFound()
+ raise errors.NotFound(reason="cannot find group %s" % group_dn)
"""
if group.get('cn') == "admins":
member = get_entry_by_dn(member_dn, ['dn','uid'])