mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-08 09:24:01 -07:00
Modules don't have to return JSON, key=value pairs is ok.
This commit is contained in:
parent
40fd778e2c
commit
4bde4926c3
4 changed files with 29 additions and 21 deletions
|
@ -18,11 +18,6 @@
|
|||
|
||||
################################################
|
||||
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
import fnmatch
|
||||
import multiprocessing
|
||||
import signal
|
||||
|
@ -209,7 +204,7 @@ class Runner(object):
|
|||
|
||||
try:
|
||||
# try to parse the JSON response
|
||||
return [ host, True, json.loads(result) ]
|
||||
return [ host, True, parse_json(result) ]
|
||||
except Exception, e:
|
||||
# it failed, say so, but return the string anyway
|
||||
return [ host, False, "%s/%s" % (str(e), result) ]
|
||||
|
@ -324,7 +319,7 @@ class Runner(object):
|
|||
if self.module_name == 'setup':
|
||||
host = conn.host
|
||||
try:
|
||||
var_result = json.loads(result)
|
||||
var_result = parse_json(result)
|
||||
except:
|
||||
var_result = {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue