403b09
From eddc43e5973cb81d88fe2e88bab5eed72d7d3cff Mon Sep 17 00:00:00 2001
403b09
From: Abhijeet Kasurde <akasurde@redhat.com>
403b09
Date: Tue, 23 Aug 2016 17:34:51 +0530
403b09
Subject: [PATCH] Handled empty hostname in server-del command
403b09
403b09
Fixes: https://fedorahosted.org/freeipa/ticket/6248
403b09
403b09
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
403b09
Reviewed-By: Martin Basti <mbasti@redhat.com>
403b09
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
403b09
---
403b09
 ipaclient/plugins/server.py | 8 ++++++--
403b09
 1 file changed, 6 insertions(+), 2 deletions(-)
403b09
403b09
diff --git a/ipaclient/plugins/server.py b/ipaclient/plugins/server.py
403b09
index 725a2ce95708529bd4e1de7fc364c2aba0d805de..5356dbbf58373eebeab1c8c59ff0e23b374a15f3 100644
403b09
--- a/ipaclient/plugins/server.py
403b09
+++ b/ipaclient/plugins/server.py
403b09
@@ -3,7 +3,7 @@
403b09
 #
403b09
 
403b09
 from ipaclient.frontend import MethodOverride
403b09
-from ipalib import _
403b09
+from ipalib import _, errors
403b09
 from ipalib.plugable import Registry
403b09
 
403b09
 register = Registry()
403b09
@@ -12,6 +12,10 @@ register = Registry()
403b09
 @register(override=True, no_fail=True)
403b09
 class server_del(MethodOverride):
403b09
     def interactive_prompt_callback(self, kw):
403b09
+        server_list = kw.get('cn')
403b09
+        if not server_list:
403b09
+            raise errors.RequirementError(name='cn')
403b09
+
403b09
         self.api.Backend.textui.print_plain(
403b09
             _("Removing %(servers)s from replication topology, "
403b09
-              "please wait...") % {'servers': ', '.join(kw['cn'])})
403b09
+              "please wait...") % {'servers': ', '.join(server_list)})
403b09
-- 
403b09
2.7.4
403b09