From f021f35447a0b71957b2294b1000f9229ea064f6 Mon Sep 17 00:00:00 2001 From: David Kupka Date: Thu, 13 Aug 2015 08:11:38 +0200 Subject: [PATCH] user-undel: Fix error messages. https://fedorahosted.org/freeipa/ticket/5207 Reviewed-By: Martin Basti --- ipalib/plugins/user.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py index 90ae7260abf935abf92b49da04c11bc76e836e49..418c51bdafc4e462e2decfe1e8541aaf49705cb0 100644 --- a/ipalib/plugins/user.py +++ b/ipalib/plugins/user.py @@ -827,16 +827,14 @@ class user_undel(LDAPQuery): # First check that the user exists and is a delete one delete_dn = self.obj.get_either_dn(*keys, **options) - if delete_dn.endswith(DN(self.obj.active_container_dn, api.env.basedn)): - raise errors.ValidationError( - name=self.obj.primary_key.cli_name, - error=_('User %r is already active') % keys[-1][0]) try: entry_attrs = self._exc_wrapper(keys, options, ldap.get_entry)(delete_dn) except errors.NotFound: - raise errors.ValidationError( - name=self.obj.primary_key.cli_name, - error=_('User %r not found') % keys[-1][0]) + self.obj.handle_not_found(*keys) + if delete_dn.endswith(DN(self.obj.active_container_dn, + api.env.basedn)): + raise errors.InvocationError( + message=_('user "%s" is already active') % keys[-1]) active_dn = DN(delete_dn[0], self.obj.active_container_dn, api.env.basedn) -- 2.4.3