On 14/08/15 17:18, Martin Basti wrote:



On 08/13/2015 08:17 AM, David Kupka wrote:
https://fedorahosted.org/freeipa/ticket/5207

Requires patch freeipa-jcholast-471.1.



NACK

This patch causes internal server error

ipa user-del user --preserve

[Fri Aug 14 17:16:13.691565 2015] [wsgi:error] [pid 3210] ipa: ERROR:
non-public: TypeError: %d format: a number is required, not str
[Fri Aug 14 17:16:13.691605 2015] [wsgi:error] [pid 3210] Traceback
(most recent call last):
[Fri Aug 14 17:16:13.691610 2015] [wsgi:error] [pid 3210]   File
"/usr/lib/python2.7/site-packages/ipaserver/rpcserver.py", line 347, in
wsgi_execute
[Fri Aug 14 17:16:13.691614 2015] [wsgi:error] [pid 3210]     result =
self.Command[name](*args, **options)
[Fri Aug 14 17:16:13.691618 2015] [wsgi:error] [pid 3210]   File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 457, in
__call__
[Fri Aug 14 17:16:13.691622 2015] [wsgi:error] [pid 3210]
self.validate_output(ret, options['version'])
[Fri Aug 14 17:16:13.691626 2015] [wsgi:error] [pid 3210]   File
"/usr/lib/python2.7/site-packages/ipalib/frontend.py", line 950, in
validate_output
[Fri Aug 14 17:16:13.691630 2015] [wsgi:error] [pid 3210]
o.validate(self, value, version)
[Fri Aug 14 17:16:13.691634 2015] [wsgi:error] [pid 3210]   File
"/usr/lib/python2.7/site-packages/ipalib/output.py", line 151, in validate
[Fri Aug 14 17:16:13.691638 2015] [wsgi:error] [pid 3210] types[0],
type(value), value))
[Fri Aug 14 17:16:13.691642 2015] [wsgi:error] [pid 3210] TypeError: %d
format: a number is required, not str
[Fri Aug 14 17:16:13.692063 2015] [wsgi:error] [pid 3210] ipa: INFO:
[jsonserver_session] ad...@example.com: user_del((u'user',),
continue=False, preserve=True, version=u'2.148'): TypeError
(END)


Thanks for catching this. Updated patch attached.

--
David Kupka
From 9f8b7b3228f739b1a5ecd1516026b7d2c030d275 Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Thu, 13 Aug 2015 08:11:38 +0200
Subject: [PATCH] user-undel: Fix error messages.

https://fedorahosted.org/freeipa/ticket/5207
---
 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 4de33b9ff80799f5e499e05ef38cfc444e69a316..1d6073b4240d963e2b047c20fe5b8be702ef3184 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

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to