mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Convert error to the native text type before writing to stderr
Fixes #20588
This commit is contained in:
parent
c00604210c
commit
d12e9f5748
1 changed files with 2 additions and 2 deletions
|
@ -77,11 +77,11 @@ class InventoryScript:
|
||||||
try:
|
try:
|
||||||
self.raw = self._loader.load(self.data)
|
self.raw = self._loader.load(self.data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
sys.stderr.write(err + "\n")
|
sys.stderr.write(to_native(err) + "\n")
|
||||||
raise AnsibleError("failed to parse executable inventory script results from {0}: {1}".format(to_native(self.filename), to_native(e)))
|
raise AnsibleError("failed to parse executable inventory script results from {0}: {1}".format(to_native(self.filename), to_native(e)))
|
||||||
|
|
||||||
if not isinstance(self.raw, Mapping):
|
if not isinstance(self.raw, Mapping):
|
||||||
sys.stderr.write(err + "\n")
|
sys.stderr.write(to_native(err) + "\n")
|
||||||
raise AnsibleError("failed to parse executable inventory script results from {0}: data needs to be formatted as a json dict".format(to_native(self.filename)))
|
raise AnsibleError("failed to parse executable inventory script results from {0}: data needs to be formatted as a json dict".format(to_native(self.filename)))
|
||||||
|
|
||||||
group = None
|
group = None
|
||||||
|
|
Loading…
Reference in a new issue