summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Zeleny <jzeleny@redhat.com>2010-12-10 19:15:53 +0100
committerRob Crittenden <rcritten@redhat.com>2010-12-10 13:52:14 -0500
commit8fd288df08d8f01893ad9637adc8987032af1886 (patch)
tree504dfaae2f1482924278b2cb566cb167bf84c6bd
parente8e274c9e0a9fb9d2ef775f99c763d97b23050b1 (diff)
downloadfreeipa-8fd288df08d8f01893ad9637adc8987032af1886.tar.gz
freeipa-8fd288df08d8f01893ad9637adc8987032af1886.tar.xz
freeipa-8fd288df08d8f01893ad9637adc8987032af1886.zip
Print expected error message in hbac-mod
This patch catches NotFound exception and calls handling function which then sends exception with unified error message. https://fedorahosted.org/freeipa/ticket/487
-rw-r--r--ipalib/plugins/hbac.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/ipalib/plugins/hbac.py b/ipalib/plugins/hbac.py
index 8e3e44e43..dde7425c6 100644
--- a/ipalib/plugins/hbac.py
+++ b/ipalib/plugins/hbac.py
@@ -231,7 +231,11 @@ class hbac_mod(LDAPUpdate):
"""
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
- (dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
+ try:
+ (dn, entry_attrs) = ldap.get_entry(dn, attrs_list)
+ except errors.NotFound:
+ self.obj.handle_not_found(*keys)
+
if is_all(options, 'usercategory') and 'memberuser' in entry_attrs:
raise errors.MutuallyExclusiveError(reason="user category cannot be set to 'all' while there are allowed users")
if is_all(options, 'hostcategory') and 'memberhost' in entry_attrs: