1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix failed to parse message handling

This commit is contained in:
Michael DeHaan 2012-08-16 21:47:17 -04:00
parent 0579b8b4e6
commit 5bb5082ed9

View file

@ -138,7 +138,7 @@ def parse_json(raw_data):
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" % raw_data)
(key,value) = t.split("=", 1) (key,value) = t.split("=", 1)
if key == 'changed' or 'failed': if key == 'changed' or 'failed':
if value.lower() in [ 'true', '1' ]: if value.lower() in [ 'true', '1' ]:
@ -149,7 +149,7 @@ def parse_json(raw_data):
value = int(value) value = int(value)
results[key] = value results[key] = value
if len(results.keys()) == 0: if len(results.keys()) == 0:
return { "failed" : True, "parsed" : False, "msg" : data } return { "failed" : True, "parsed" : False, "msg" : raw_data }
return results return results
_LISTRE = re.compile(r"(\w+)\[(\d+)\]") _LISTRE = re.compile(r"(\w+)\[(\d+)\]")