summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2009-05-08 11:15:45 -0400
committerRob Crittenden <rcritten@redhat.com>2009-05-13 14:16:44 -0400
commit1c31b5bc08a2f4bc55678c69eb67508122480906 (patch)
tree0166354ab5bb1e8bb4b664efab23bb86e770556a /ipalib/plugins
parentde88954b91f49387421f68a056a2e12cb6e94e7e (diff)
downloadfreeipa-1c31b5bc08a2f4bc55678c69eb67508122480906.tar.gz
freeipa-1c31b5bc08a2f4bc55678c69eb67508122480906.tar.xz
freeipa-1c31b5bc08a2f4bc55678c69eb67508122480906.zip
Add a reason to the NotFound exception so we can provide more robust errors
Diffstat (limited to 'ipalib/plugins')
-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
5 files changed, 11 insertions, 11 deletions
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']