Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
9de64718
Commit
9de64718
authored
Jul 03, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11449 from msabramo/make_test-module_work_in_v2
Make test module work in v2
parents
4d35d8bd
3b0524e6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
hacking/test-module
+7
-5
No files found.
hacking/test-module
View file @
9de64718
...
...
@@ -35,6 +35,8 @@ import subprocess
import
traceback
import
optparse
import
ansible.utils
as
utils
from
ansible.parsing.utils.jsonify
import
jsonify
from
ansible.parsing.splitter
import
parse_kv
import
ansible.module_common
as
module_common
import
ansible.constants
as
C
...
...
@@ -74,8 +76,8 @@ def write_argsfile(argstring, json=False):
argspath
=
os
.
path
.
expanduser
(
"~/.ansible_test_module_arguments"
)
argsfile
=
open
(
argspath
,
'w'
)
if
json
:
args
=
utils
.
parse_kv
(
argstring
)
argstring
=
utils
.
jsonify
(
args
)
args
=
parse_kv
(
argstring
)
argstring
=
jsonify
(
args
)
argsfile
.
write
(
argstring
)
argsfile
.
close
()
return
argspath
...
...
@@ -150,7 +152,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 +162,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."""
...
...
@@ -175,7 +177,7 @@ def main():
options
,
args
=
parse
()
(
modfile
,
module_style
)
=
boilerplate_module
(
options
.
module_path
,
options
.
module_args
,
options
.
interpreter
,
options
.
check
)
argspath
=
None
argspath
=
None
if
module_style
!=
'new'
:
if
module_style
==
'non_native_want_json'
:
argspath
=
write_argsfile
(
options
.
module_args
,
json
=
True
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment