mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-13 09:41:55 -06:00
Fix traceback if zonemgr error contains unicode
Ticket: https://fedorahosted.org/freeipa/ticket/4805 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
parent
9225624fd8
commit
727f8099af
@ -411,7 +411,14 @@ def zonemgr_callback(option, opt_str, value, parser):
|
|||||||
value = value.decode(encoding)
|
value = value.decode(encoding)
|
||||||
validate_zonemgr_str(value)
|
validate_zonemgr_str(value)
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
parser.error("invalid zonemgr: " + unicode(e))
|
# FIXME we can do this in better way
|
||||||
|
# https://fedorahosted.org/freeipa/ticket/4804
|
||||||
|
# decode to proper stderr encoding
|
||||||
|
stderr_encoding = getattr(sys.stderr, 'encoding', None)
|
||||||
|
if stderr_encoding is None:
|
||||||
|
stderr_encoding = 'utf-8'
|
||||||
|
error = unicode(e).encode(stderr_encoding)
|
||||||
|
parser.error("invalid zonemgr: " + error)
|
||||||
|
|
||||||
parser.values.zonemgr = value
|
parser.values.zonemgr = value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user