mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-06-23 09:14:43 +00:00
ipaclient_test: Fix Python2 decode use with Python3
This is a remain of the Python2 version and has been fixed. Fixed: #86 (AttributeError: 'str' object has no attribute 'decode')
This commit is contained in:
@@ -469,12 +469,19 @@ def main():
|
||||
|
||||
# validate zonemgr
|
||||
if options.zonemgr:
|
||||
if six.PY3:
|
||||
with redirect_stdout(ansible_log):
|
||||
bindinstance.validate_zonemgr_str(options.zonemgr)
|
||||
else:
|
||||
try:
|
||||
# IDNA support requires unicode
|
||||
encoding = getattr(sys.stdin, 'encoding', None)
|
||||
if encoding is None:
|
||||
encoding = 'utf-8'
|
||||
if not isinstance(value, unicode):
|
||||
value = options.zonemgr.decode(encoding)
|
||||
else:
|
||||
value = options.zonemgr
|
||||
with redirect_stdout(ansible_log):
|
||||
bindinstance.validate_zonemgr_str(value)
|
||||
except ValueError as e:
|
||||
|
||||
Reference in New Issue
Block a user