mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make test-module work in v2
- `jsonify` moved from `ansible.utils` to `ansible.parsing.utils.jsonify` - I don't see `ansible.utils.parse_json` anymore so I used `json.loads`.
This commit is contained in:
parent
468770c894
commit
ea6ec3bf2c
1 changed files with 4 additions and 3 deletions
|
@ -35,6 +35,7 @@ import subprocess
|
|||
import traceback
|
||||
import optparse
|
||||
import ansible.utils as utils
|
||||
from ansible.parsing.utils.jsonify import jsonify
|
||||
import ansible.module_common as module_common
|
||||
import ansible.constants as C
|
||||
|
||||
|
@ -75,7 +76,7 @@ def write_argsfile(argstring, json=False):
|
|||
argsfile = open(argspath, 'w')
|
||||
if json:
|
||||
args = utils.parse_kv(argstring)
|
||||
argstring = utils.jsonify(args)
|
||||
argstring = jsonify(args)
|
||||
argsfile.write(argstring)
|
||||
argsfile.close()
|
||||
return argspath
|
||||
|
@ -150,7 +151,7 @@ def runtest( modfile, argspath):
|
|||
print "RAW OUTPUT"
|
||||
print out
|
||||
print err
|
||||
results = utils.parse_json(out)
|
||||
results = json.loads(out)
|
||||
except:
|
||||
print "***********************************"
|
||||
print "INVALID OUTPUT FORMAT"
|
||||
|
@ -160,7 +161,7 @@ def runtest( modfile, argspath):
|
|||
|
||||
print "***********************************"
|
||||
print "PARSED OUTPUT"
|
||||
print utils.jsonify(results,format=True)
|
||||
print jsonify(results,format=True)
|
||||
|
||||
def rundebug(debugger, modfile, argspath):
|
||||
"""Run interactively with console debugger."""
|
||||
|
|
Loading…
Reference in a new issue