ansible.utils to_unicode/to_bytes isn't robust in the face of
non-strings. Do some value checking in the calling code
This commit is contained in:
parent
418e24cc6c
commit
35321ec642
1 changed files with 6 additions and 1 deletions
|
@ -27,6 +27,7 @@ import fcntl
|
|||
import constants
|
||||
import locale
|
||||
from ansible.color import stringc
|
||||
from ansible.module_utils import basic
|
||||
|
||||
import logging
|
||||
if constants.DEFAULT_LOG_PATH != '':
|
||||
|
@ -456,8 +457,12 @@ class PlaybookRunnerCallbacks(DefaultRunnerCallbacks):
|
|||
item = None
|
||||
if type(results) == dict:
|
||||
item = results.get('item', None)
|
||||
host = utils.to_bytes(host)
|
||||
if isinstance(item, unicode):
|
||||
item = utils.to_bytes(item)
|
||||
results = basic.json_dict_unicode_to_bytes(results)
|
||||
else:
|
||||
results = utils.to_bytes(results)
|
||||
host = utils.to_bytes(host)
|
||||
if item:
|
||||
msg = "fatal: [%s] => (item=%s) => %s" % (host, item, results)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue