Merge pull request #5170 from AlanCoding/py2_fix2

Fix multibyte character handling issue for tower_job_wait #55585

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-11-14 19:33:50 +00:00 committed by GitHub
commit 6567ad612c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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')