My bad Martin^2. Here is an updated patch.

Gabe

On Thu, Oct 29, 2015 at 7:14 AM, Martin Basti <mba...@redhat.com> wrote:

>
>
> On 28.10.2015 02:35, Gabe Alford wrote:
>
> Hello,
>
> Fix for https://fedorahosted.org/freeipa/ticket/5355
>
> Thanks,
>
> Gabe
>
>
> Thank you Gabe, but patch needs more work to be complete:
>
> Bool and integer choices also need to strip whitespaces, see bellow:
>
> Do you want to configure DNS forwarders? [yes]:   no
> Do you want to configure DNS forwarders? [yes]:   no
> Do you want to configure DNS forwarders? [yes]:   no
> Do you want to configure DNS forwarders? [yes]: no
> No DNS forwarders configured
>
> Martin^2
>
>
From f72f14b973d91689e5d139e6cc9e7ed5e5d5a2d6 Mon Sep 17 00:00:00 2001
From: Gabe <redhatri...@gmail.com>
Date: Thu, 29 Oct 2015 07:37:36 -0600
Subject: [PATCH] interactive installer does not ignore leading/trailing
 whitespace

https://fedorahosted.org/freeipa/ticket/5355
---
 ipapython/ipautil.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index b6fd11338f5f55402d5e4502297866f3b0cc0534..4acdd1a98818bf311a8fef103e7219cc62a28ec1 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -763,7 +763,7 @@ def user_input(prompt, default = None, allow_empty = True):
             try:
                 ret = input("%s: " % prompt)
                 if allow_empty or ret.strip():
-                    return ret
+                    return ret.strip()
             except EOFError:
                 if allow_empty:
                     return ''
@@ -776,7 +776,7 @@ def user_input(prompt, default = None, allow_empty = True):
                 if not ret and (allow_empty or default):
                     return default
                 elif ret.strip():
-                    return ret
+                    return ret.strip()
             except EOFError:
                 return default
 
@@ -785,6 +785,7 @@ def user_input(prompt, default = None, allow_empty = True):
         while True:
             try:
                 ret = input("%s [%s]: " % (prompt, choice))
+                ret = ret.strip()
                 if not ret:
                     return default
                 elif ret.lower()[0] == "y":
@@ -798,6 +799,7 @@ def user_input(prompt, default = None, allow_empty = True):
         while True:
             try:
                 ret = input("%s [%s]: " % (prompt, default))
+                ret = ret.strip()
                 if not ret:
                     return default
                 ret = int(ret)
-- 
1.8.3.1

-- 
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