Blob Blame History Raw
From 5fb2c0f8c7237214f870d341cc10a2ccda48d117 Mon Sep 17 00:00:00 2001
From: Martin Basti <mbasti@redhat.com>
Date: Fri, 10 Jul 2015 14:47:59 +0200
Subject: [PATCH] Stageusedr-activate: show username instead of DN

If activate user already exists, show name of this user in error message
instead of user DN.
Error message reworder to keep the same format as stageuser-add,
user-add.

https://fedorahosted.org/freeipa/ticket/5038

Reviewed-By: David Kupka <dkupka@redhat.com>
---
 ipalib/plugins/stageuser.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ipalib/plugins/stageuser.py b/ipalib/plugins/stageuser.py
index 35e636ded4474b00ad635c60340aaf66e6b41752..6cbc8f4ab07f2c1172f2b2c45bfe8f30a74938b3 100644
--- a/ipalib/plugins/stageuser.py
+++ b/ipalib/plugins/stageuser.py
@@ -682,8 +682,9 @@ class stageuser_activate(LDAPQuery):
                 active_dn, ['dn']
             )
             assert isinstance(staging_dn, DN)
-            raise errors.DuplicateEntry(message=_('Active user %(user)s already exists') % dict(
-                            user=test_entry_attrs.dn))
+            raise errors.DuplicateEntry(
+                message=_('active user with name "%(user)s" already exists') %
+                dict(user=args[-1]))
         except errors.NotFound:
             pass
 
-- 
2.1.0