Workaround more python-2.6 shlex not being able to handle unicode strings

This commit is contained in:
Toshio Kuratomi 2014-10-08 14:30:36 -04:00
parent a6029264b8
commit a10d10f647
4 changed files with 32 additions and 22 deletions

View file

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