e3ffab
From 296656789c1bc8e2667c989d10cac300f8b5b7fc Mon Sep 17 00:00:00 2001
e3ffab
From: Martin Basti <mbasti@redhat.com>
e3ffab
Date: Mon, 24 Nov 2014 12:46:37 +0100
e3ffab
Subject: [PATCH] Fix detection of encoding in zonemgr option
e3ffab
e3ffab
Ticket: https://fedorahosted.org/freeipa/ticket/4762
e3ffab
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
e3ffab
---
e3ffab
 ipaserver/install/bindinstance.py | 15 ++++++++-------
e3ffab
 1 file changed, 8 insertions(+), 7 deletions(-)
e3ffab
e3ffab
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
e3ffab
index 5bf784e62aec7c323a84fc5130e53c3deb86e6fd..f02fe8647dd38d05734311406152c50108077561 100644
e3ffab
--- a/ipaserver/install/bindinstance.py
e3ffab
+++ b/ipaserver/install/bindinstance.py
e3ffab
@@ -401,13 +401,14 @@ def zonemgr_callback(option, opt_str, value, parser):
e3ffab
     """
e3ffab
     Properly validate and convert --zonemgr Option to IA5String
e3ffab
     """
e3ffab
-    # validate the value first
e3ffab
-    try:
e3ffab
-        # IDNA support requires unicode
e3ffab
-        value = value.decode(sys.stdin.encoding)
e3ffab
-        validate_zonemgr_str(value)
e3ffab
-    except ValueError, e:
e3ffab
-        parser.error("invalid zonemgr: " + unicode(e))
e3ffab
+    if value is not None:
e3ffab
+        # validate the value first
e3ffab
+        try:
e3ffab
+            # IDNA support requires unicode
e3ffab
+            value = value.decode(getattr(sys.stdin, 'encoding', 'utf-8'))
e3ffab
+            validate_zonemgr_str(value)
e3ffab
+        except ValueError, e:
e3ffab
+            parser.error("invalid zonemgr: " + unicode(e))
e3ffab
 
e3ffab
     parser.values.zonemgr = value
e3ffab
 
e3ffab
-- 
e3ffab
2.1.0
e3ffab