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
e50c2bcc
Commit
e50c2bcc
authored
Dec 30, 2013
by
Matt Martz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add -I/--interpreter argument to test-module
parent
c45f1662
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
hacking/test-module
+15
-2
No files found.
hacking/test-module
View file @
e50c2bcc
...
@@ -56,6 +56,9 @@ def parse():
...
@@ -56,6 +56,9 @@ def parse():
help
=
"module argument string"
)
help
=
"module argument string"
)
parser
.
add_option
(
'-D'
,
'--debugger'
,
dest
=
'debugger'
,
parser
.
add_option
(
'-D'
,
'--debugger'
,
dest
=
'debugger'
,
help
=
"path to python debugger (e.g. /usr/bin/pdb)"
)
help
=
"path to python debugger (e.g. /usr/bin/pdb)"
)
parser
.
add_option
(
'-I'
,
'--interpreter'
,
dest
=
'interpreter'
,
help
=
"path to interpeter to use for this module (e.g. ansible_python_interpreter=/usr/bin/python)"
,
metavar
=
'INTERPRETER_TYPE=INTERPRETER_PATH'
)
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
()
if
not
options
.
module_path
:
if
not
options
.
module_path
:
parser
.
print_help
()
parser
.
print_help
()
...
@@ -74,7 +77,7 @@ def write_argsfile(argstring, json=False):
...
@@ -74,7 +77,7 @@ def write_argsfile(argstring, json=False):
argsfile
.
close
()
argsfile
.
close
()
return
argspath
return
argspath
def
boilerplate_module
(
modfile
,
args
):
def
boilerplate_module
(
modfile
,
args
,
interpreter
):
""" simulate what ansible does with new style modules """
""" simulate what ansible does with new style modules """
#module_fh = open(modfile)
#module_fh = open(modfile)
...
@@ -87,6 +90,16 @@ def boilerplate_module(modfile, args):
...
@@ -87,6 +90,16 @@ def boilerplate_module(modfile, args):
complex_args
=
{}
complex_args
=
{}
inject
=
{}
inject
=
{}
if
interpreter
:
if
'='
not
in
interpreter
:
print
'interpeter must by in the form of ansible_python_interpreter=/usr/bin/python'
sys
.
exit
(
1
)
interpreter_type
,
interpreter_path
=
interpreter
.
split
(
'='
)
if
not
interpreter_type
.
startswith
(
'ansible_'
):
interpreter_type
=
'ansible_
%
s'
%
interpreter_type
if
not
interpreter_type
.
endswith
(
'_interpreter'
):
interpreter_type
=
'
%
s_interpreter'
%
interpreter_type
inject
[
interpreter_type
]
=
interpreter_path
(
module_data
,
module_style
,
shebang
)
=
replacer
.
modify_module
(
(
module_data
,
module_style
,
shebang
)
=
replacer
.
modify_module
(
modfile
,
modfile
,
complex_args
,
complex_args
,
...
@@ -144,7 +157,7 @@ def rundebug(debugger, modfile, argspath):
...
@@ -144,7 +157,7 @@ def rundebug(debugger, modfile, argspath):
def
main
():
def
main
():
options
,
args
=
parse
()
options
,
args
=
parse
()
(
modfile
,
module_style
)
=
boilerplate_module
(
options
.
module_path
,
options
.
module_args
)
(
modfile
,
module_style
)
=
boilerplate_module
(
options
.
module_path
,
options
.
module_args
,
options
.
interpreter
)
argspath
=
None
argspath
=
None
if
module_style
!=
'new'
:
if
module_style
!=
'new'
:
...
...
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