From 8fd288df08d8f01893ad9637adc8987032af1886 Mon Sep 17 00:00:00 2001 From: Jan Zeleny Date: Fri, 10 Dec 2010 19:15:53 +0100 Subject: 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 --- ipalib/plugins/hbac.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ipalib/plugins/hbac.py b/ipalib/plugins/hbac.py index 8e3e44e4..dde7425c 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: -- cgit