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
This commit is contained in:
Jan Zeleny 2010-11-29 09:37:47 -05:00 committed by Rob Crittenden
parent df48c9cf71
commit 58bcb5e7f9

View File

@ -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)