mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Workaround more python-2.6 shlex not being able to handle unicode strings
This commit is contained in:
@@ -22,6 +22,7 @@ import subprocess
|
||||
import ansible.constants as C
|
||||
from ansible.inventory.host import Host
|
||||
from ansible.inventory.group import Group
|
||||
from ansible.module_utils.basic import json_dict_unicode_to_bytes
|
||||
from ansible import utils
|
||||
from ansible import errors
|
||||
import sys
|
||||
@@ -54,7 +55,7 @@ class InventoryScript(object):
|
||||
|
||||
# not passing from_remote because data from CMDB is trusted
|
||||
self.raw = utils.parse_json(self.data)
|
||||
self.raw = utils.json_dict_unicode_to_bytes(self.raw)
|
||||
self.raw = json_dict_unicode_to_bytes(self.raw)
|
||||
|
||||
all = Group('all')
|
||||
groups = dict(all=all)
|
||||
@@ -143,7 +144,7 @@ class InventoryScript(object):
|
||||
if out.strip() == '':
|
||||
return dict()
|
||||
try:
|
||||
return utils.json_dict_unicode_to_bytes(utils.parse_json(out))
|
||||
return json_dict_unicode_to_bytes(utils.parse_json(out))
|
||||
except ValueError:
|
||||
raise errors.AnsibleError("could not parse post variable response: %s, %s" % (cmd, out))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user