From cb354c2ef1685332c7d255aa18311d5d03e07884 Mon Sep 17 00:00:00 2001 From: Hideki Saito Date: Mon, 22 Apr 2019 09:19:02 +0000 Subject: [PATCH] Fix multibyte character handling issue for tower_job_wait #55585 Add multibyte hostname handling test as an integration test Signed-off-by: Hideki Saito --- awx_collection/plugins/modules/tower_job_wait.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/awx_collection/plugins/modules/tower_job_wait.py b/awx_collection/plugins/modules/tower_job_wait.py index c6866db2c8..aa160adb27 100644 --- a/awx_collection/plugins/modules/tower_job_wait.py +++ b/awx_collection/plugins/modules/tower_job_wait.py @@ -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')