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

Patch attached.

This patch fixes only first part of problem -- the traceback.

Removing promt for name and surname requires too big hacks in internal API, and I'm not sure if we will be able to do that.
IMO this should be separate command, I will open a discussion.

--
Martin Basti

From 9070188781d2240af4b4e8444331c8d3428c79ac Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Thu, 23 Jul 2015 10:52:54 +0200
Subject: [PATCH] ULC: Fix stageused-add --from-delete command

Nonexistent method was used to move deleted user to staged area.
Minor fixes added:
 * handle not found error
 * return new DN

https://fedorahosted.org/freeipa/ticket/5145
---
 ipalib/plugins/stageuser.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/ipalib/plugins/stageuser.py b/ipalib/plugins/stageuser.py
index 6cbc8f4ab07f2c1172f2b2c45bfe8f30a74938b3..1a388e9d09aa5196bc0592f3a86867a832d11a61 100644
--- a/ipalib/plugins/stageuser.py
+++ b/ipalib/plugins/stageuser.py
@@ -377,16 +377,17 @@ class stageuser_add(baseuser_add):
 
             staging_dn = self.obj.get_dn(*keys, **options)
             delete_dn = DN(staging_dn[0], self.obj.delete_container_dn, api.env.basedn)
-
+            new_dn = DN(staging_dn[0], self.obj.stage_container_dn, api.env.basedn)
             # Check that this value is a Active user
             try:
                 entry_attrs = self._exc_wrapper(keys, options, ldap.get_entry)(delete_dn, ['dn'])
             except errors.NotFound:
-                raise
-            self._exc_wrapper(keys, options, ldap.move_entry_newsuperior)(delete_dn, str(DN(self.obj.stage_container_dn, api.env.basedn)))
+                self.obj.handle_not_found(*keys)
 
+            self._exc_wrapper(keys, options, ldap.move_entry)(
+                delete_dn, new_dn)
             entry_attrs = entry_to_dict(entry_attrs, **options)
-            entry_attrs['dn'] = delete_dn
+            entry_attrs['dn'] = new_dn
 
             if self.obj.primary_key and keys[-1] is not None:
                 return dict(result=entry_attrs, value=keys[-1])
-- 
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