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
cd478a76
Commit
cd478a76
authored
Sep 07, 2015
by
h-hirokawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the new module replacer <<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>.
Fixes #12266
parent
718812d9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
lib/ansible/executor/module_common.py
+14
-10
No files found.
lib/ansible/executor/module_common.py
View file @
cd478a76
...
@@ -33,12 +33,13 @@ from ansible.errors import AnsibleError
...
@@ -33,12 +33,13 @@ from ansible.errors import AnsibleError
from
ansible.parsing.utils.jsonify
import
jsonify
from
ansible.parsing.utils.jsonify
import
jsonify
from
ansible.utils.unicode
import
to_bytes
from
ansible.utils.unicode
import
to_bytes
REPLACER
=
"#<<INCLUDE_ANSIBLE_MODULE_COMMON>>"
REPLACER
=
"#<<INCLUDE_ANSIBLE_MODULE_COMMON>>"
REPLACER_ARGS
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_ARGS>>
\"
"
REPLACER_ARGS
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_ARGS>>
\"
"
REPLACER_COMPLEX
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>
\"
"
REPLACER_COMPLEX
=
"
\"
<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>
\"
"
REPLACER_WINDOWS
=
"# POWERSHELL_COMMON"
REPLACER_WINDOWS
=
"# POWERSHELL_COMMON"
REPLACER_WINARGS
=
"<<INCLUDE_ANSIBLE_MODULE_WINDOWS_ARGS>>"
REPLACER_WINARGS
=
"<<INCLUDE_ANSIBLE_MODULE_WINDOWS_ARGS>>"
REPLACER_VERSION
=
"
\"
<<ANSIBLE_VERSION>>
\"
"
REPLACER_JSONARGS
=
"<<INCLUDE_ANSIBLE_MODULE_JSON_ARGS>>"
REPLACER_VERSION
=
"
\"
<<ANSIBLE_VERSION>>
\"
"
# We could end up writing out parameters with unicode characters so we need to
# We could end up writing out parameters with unicode characters so we need to
# specify an encoding for the python source file
# specify an encoding for the python source file
...
@@ -68,6 +69,8 @@ def _find_snippet_imports(module_data, module_path, strip_comments):
...
@@ -68,6 +69,8 @@ def _find_snippet_imports(module_data, module_path, strip_comments):
module_style
=
'new'
module_style
=
'new'
elif
REPLACER_WINDOWS
in
module_data
:
elif
REPLACER_WINDOWS
in
module_data
:
module_style
=
'new'
module_style
=
'new'
elif
REPLACER_JSONARGS
in
module_data
:
module_style
=
'new'
elif
'from ansible.module_utils.'
in
module_data
:
elif
'from ansible.module_utils.'
in
module_data
:
module_style
=
'new'
module_style
=
'new'
elif
'WANT_JSON'
in
module_data
:
elif
'WANT_JSON'
in
module_data
:
...
@@ -162,13 +165,14 @@ def modify_module(module_path, module_args, task_vars=dict(), strip_comments=Fal
...
@@ -162,13 +165,14 @@ def modify_module(module_path, module_args, task_vars=dict(), strip_comments=Fal
(
module_data
,
module_style
)
=
_find_snippet_imports
(
module_data
,
module_path
,
strip_comments
)
(
module_data
,
module_style
)
=
_find_snippet_imports
(
module_data
,
module_path
,
strip_comments
)
module_args_json
=
json
.
dumps
(
module_args
)
module_args_json
=
json
.
dumps
(
module_args
)
.
encode
(
'utf-8'
)
encoded_args
=
repr
(
module_args_json
.
encode
(
'utf-8'
)
)
python_repred_args
=
repr
(
module_args_json
)
# these strings should be part of the 'basic' snippet which is required to be included
# these strings should be part of the 'basic' snippet which is required to be included
module_data
=
module_data
.
replace
(
REPLACER_VERSION
,
repr
(
__version__
))
module_data
=
module_data
.
replace
(
REPLACER_VERSION
,
repr
(
__version__
))
module_data
=
module_data
.
replace
(
REPLACER_COMPLEX
,
encoded_args
)
module_data
=
module_data
.
replace
(
REPLACER_COMPLEX
,
python_repred_args
)
module_data
=
module_data
.
replace
(
REPLACER_WINARGS
,
module_args_json
.
encode
(
'utf-8'
))
module_data
=
module_data
.
replace
(
REPLACER_WINARGS
,
module_args_json
)
module_data
=
module_data
.
replace
(
REPLACER_JSONARGS
,
module_args_json
)
if
module_style
==
'new'
:
if
module_style
==
'new'
:
facility
=
C
.
DEFAULT_SYSLOG_FACILITY
facility
=
C
.
DEFAULT_SYSLOG_FACILITY
...
...
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