mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix UTF-8 output when using executable inventory files
The 'hostname' variable is then unicode, which breaks interpolating stdout etc. contents into the output strings (they are bytes and cannot be converted to Unicode using ASCII codec)
This commit is contained in:
parent
73b0dd4ac0
commit
94f56614e7
1 changed files with 3 additions and 0 deletions
|
@ -136,6 +136,9 @@ def command_generic_msg(hostname, result, oneline, caption):
|
||||||
stderr = result.get('stderr', '')
|
stderr = result.get('stderr', '')
|
||||||
msg = result.get('msg', '')
|
msg = result.get('msg', '')
|
||||||
|
|
||||||
|
hostname = hostname.encode('utf-8')
|
||||||
|
caption = caption.encode('utf-8')
|
||||||
|
|
||||||
if not oneline:
|
if not oneline:
|
||||||
buf = "%s | %s | rc=%s >>\n" % (hostname, caption, result.get('rc',0))
|
buf = "%s | %s | rc=%s >>\n" % (hostname, caption, result.get('rc',0))
|
||||||
if stdout:
|
if stdout:
|
||||||
|
|
Loading…
Reference in a new issue