mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
Make dynamic inventory return byte str, not unicode
This commit is contained in:
@@ -26,6 +26,7 @@ from ansible import utils
|
||||
from ansible import errors
|
||||
import sys
|
||||
|
||||
|
||||
class InventoryScript(object):
|
||||
''' Host inventory parser for ansible using external inventory scripts. '''
|
||||
|
||||
@@ -53,6 +54,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)
|
||||
|
||||
all = Group('all')
|
||||
groups = dict(all=all)
|
||||
@@ -141,7 +143,7 @@ class InventoryScript(object):
|
||||
if out.strip() == '':
|
||||
return dict()
|
||||
try:
|
||||
return utils.parse_json(out)
|
||||
return utils.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