summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2014-11-24 12:46:37 +0100
committerJan Cholasta <jcholast@redhat.com>2014-11-24 13:20:35 +0000
commit230df95ed9e043069da0008d046b6b0135b0a8d1 (patch)
treeb9976bc9fd233c842095eb1fa9f5b68b7c841ba4
parent5c0ad221e815e8c7b95c1d1095ebd6cf18e7e11c (diff)
downloadfreeipa-230df95ed9e043069da0008d046b6b0135b0a8d1.tar.gz
freeipa-230df95ed9e043069da0008d046b6b0135b0a8d1.tar.xz
freeipa-230df95ed9e043069da0008d046b6b0135b0a8d1.zip
Fix detection of encoding in zonemgr option
Ticket: https://fedorahosted.org/freeipa/ticket/4762 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
-rw-r--r--ipaserver/install/bindinstance.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 5bf784e62..f02fe8647 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -401,13 +401,14 @@ def zonemgr_callback(option, opt_str, value, parser):
"""
Properly validate and convert --zonemgr Option to IA5String
"""
- # validate the value first
- try:
- # IDNA support requires unicode
- value = value.decode(sys.stdin.encoding)
- validate_zonemgr_str(value)
- except ValueError, e:
- parser.error("invalid zonemgr: " + unicode(e))
+ if value is not None:
+ # validate the value first
+ try:
+ # IDNA support requires unicode
+ value = value.decode(getattr(sys.stdin, 'encoding', 'utf-8'))
+ validate_zonemgr_str(value)
+ except ValueError, e:
+ parser.error("invalid zonemgr: " + unicode(e))
parser.values.zonemgr = value