summaryrefslogtreecommitdiff
path: root/lib/ansible/executor/module_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/executor/module_common.py')
-rw-r--r--lib/ansible/executor/module_common.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ansible/executor/module_common.py b/lib/ansible/executor/module_common.py
index 85dcafb961..09fdaa46d8 100644
--- a/lib/ansible/executor/module_common.py
+++ b/lib/ansible/executor/module_common.py
@@ -37,6 +37,7 @@ REPLACER = "#<<INCLUDE_ANSIBLE_MODULE_COMMON>>"
REPLACER_ARGS = "\"<<INCLUDE_ANSIBLE_MODULE_ARGS>>\""
REPLACER_COMPLEX = "\"<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>\""
REPLACER_WINDOWS = "# POWERSHELL_COMMON"
+REPLACER_WINARGS = "<<INCLUDE_ANSIBLE_MODULE_WINDOWS_ARGS>>"
REPLACER_VERSION = "\"<<ANSIBLE_VERSION>>\""
# We could end up writing out parameters with unicode characters so we need to
@@ -65,6 +66,8 @@ def _find_snippet_imports(module_data, module_path, strip_comments):
module_style = 'old'
if REPLACER in module_data:
module_style = 'new'
+ elif REPLACER_WINDOWS in module_data:
+ module_style = 'new'
elif 'from ansible.module_utils.' in module_data:
module_style = 'new'
elif 'WANT_JSON' in module_data:
@@ -165,6 +168,7 @@ def modify_module(module_path, module_args, task_vars=dict(), strip_comments=Fal
# 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_COMPLEX, encoded_args)
+ module_data = module_data.replace(REPLACER_WINARGS, module_args_json.encode('utf-8'))
if module_style == 'new':
facility = C.DEFAULT_SYSLOG_FACILITY