Fix multibyte character handling issue for tower_job_wait #55585

Add multibyte hostname handling test as an integration test

Signed-off-by: Hideki Saito <saito@fgrep.org>
This commit is contained in:
Hideki Saito 2019-04-22 09:19:02 +00:00 committed by AlanCoding
parent 784d18705c
commit cb354c2ef1
No known key found for this signature in database
GPG Key ID: FD2C3C012A72926B

View File

@ -87,7 +87,9 @@ status:
from ..module_utils.ansible_tower import TowerModule, tower_auth_config, tower_check_mode
from ansible.module_utils.six import PY2
from ansible.module_utils.six.moves import cStringIO as StringIO
from codecs import getwriter
try:
@ -123,7 +125,10 @@ def main():
# tower-cli gets very noisy when monitoring.
# We pass in our our outfile to suppress the out during our monitor call.
outfile = StringIO()
if PY2:
outfile = getwriter('utf-8')(StringIO())
else:
outfile = StringIO()
params['outfile'] = outfile
job_id = params.get('job_id')