e3ffab
From 818fb211ae6e66de4014036cf2a003ade42a5c4a Mon Sep 17 00:00:00 2001
e3ffab
From: Martin Basti <mbasti@redhat.com>
e3ffab
Date: Tue, 25 Nov 2014 14:03:27 +0100
e3ffab
Subject: [PATCH] Fix zonemgr option encoding detection
e3ffab
e3ffab
Ticket: https://fedorahosted.org/freeipa/ticket/4766
e3ffab
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
e3ffab
---
e3ffab
 ipaserver/install/bindinstance.py | 5 ++++-
e3ffab
 1 file changed, 4 insertions(+), 1 deletion(-)
e3ffab
e3ffab
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
e3ffab
index f02fe8647dd38d05734311406152c50108077561..547cf19ee36140b5f29fcf7d217933fa68e1952b 100644
e3ffab
--- a/ipaserver/install/bindinstance.py
e3ffab
+++ b/ipaserver/install/bindinstance.py
e3ffab
@@ -405,7 +405,10 @@ def zonemgr_callback(option, opt_str, value, parser):
e3ffab
         # validate the value first
e3ffab
         try:
e3ffab
             # IDNA support requires unicode
e3ffab
-            value = value.decode(getattr(sys.stdin, 'encoding', 'utf-8'))
e3ffab
+            encoding = getattr(sys.stdin, 'encoding', None)
e3ffab
+            if encoding is None:
e3ffab
+                encoding = 'utf-8'
e3ffab
+            value = value.decode(encoding)
e3ffab
             validate_zonemgr_str(value)
e3ffab
         except ValueError, e:
e3ffab
             parser.error("invalid zonemgr: " + unicode(e))
e3ffab
-- 
e3ffab
2.1.0
e3ffab