From 58bcb5e7f9eb5e249bf19f562dcfcf7acddc6987 Mon Sep 17 00:00:00 2001 From: Jan Zeleny Date: Mon, 29 Nov 2010 09:37:47 -0500 Subject: [PATCH] Handle error messages during various HBAC operations During some HBAC operations, various error messages were handled incorrectly - displaying only generic error messages instead of correct ones, which were defined for the module. This patch adds catching these generic exceptions and raising new exceptions with the correct error message. https://fedorahosted.org/freeipa/ticket/487 --- ipalib/plugins/hbac.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ipalib/plugins/hbac.py b/ipalib/plugins/hbac.py index d00bcc08e..17154e937 100644 --- a/ipalib/plugins/hbac.py +++ b/ipalib/plugins/hbac.py @@ -266,6 +266,8 @@ class hbac_enable(LDAPQuery): ldap.update_entry(dn, entry_attrs) except errors.EmptyModlist: pass + except errors.NotFound: + self.obj.handle_not_found(cn) return dict(result=True) @@ -290,6 +292,8 @@ class hbac_disable(LDAPQuery): ldap.update_entry(dn, entry_attrs) except errors.EmptyModlist: pass + except errors.NotFound: + self.obj.handle_not_found(cn) return dict(result=True) @@ -325,6 +329,8 @@ class hbac_add_accesstime(LDAPQuery): ldap.update_entry(dn, entry_attrs) except errors.EmptyModlist: pass + except errors.NotFound: + self.obj.handle_not_found(cn) return dict(result=True) @@ -363,6 +369,8 @@ class hbac_remove_accesstime(LDAPQuery): ldap.update_entry(dn, entry_attrs) except (ValueError, errors.EmptyModlist): pass + except errors.NotFound: + self.obj.handle_not_found(cn) return dict(result=True)