mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #475 from nafeger/devel
Better error messaging in utils
This commit is contained in:
commit
c0a5d91592
1 changed files with 6 additions and 1 deletions
|
@ -182,7 +182,12 @@ def parse_json(data):
|
||||||
# not JSON, but try "Baby JSON" which allows many of our modules to not
|
# not JSON, but try "Baby JSON" which allows many of our modules to not
|
||||||
# require JSON and makes writing modules in bash much simpler
|
# require JSON and makes writing modules in bash much simpler
|
||||||
results = {}
|
results = {}
|
||||||
tokens = shlex.split(data)
|
try :
|
||||||
|
tokens = shlex.split(data)
|
||||||
|
except:
|
||||||
|
print "failed to parse json: "+ data
|
||||||
|
raise;
|
||||||
|
|
||||||
for t in tokens:
|
for t in tokens:
|
||||||
if t.find("=") == -1:
|
if t.find("=") == -1:
|
||||||
raise errors.AnsibleError("failed to parse: %s" % data)
|
raise errors.AnsibleError("failed to parse: %s" % data)
|
||||||
|
|
Loading…
Reference in a new issue