Commit 01a6081b by Toshio Kuratomi

First swing at making module_common.py more v2-ish

parent 0e834509
......@@ -43,7 +43,7 @@ BOOLEANS = BOOLEANS_TRUE + BOOLEANS_FALSE
# can be inserted in any module source automatically by including
# #<<INCLUDE_ANSIBLE_MODULE_COMMON>> on a blank line by itself inside
# of an ansible module. The source of this common code lives
# in lib/ansible/module_common.py
# in ansible/executor/module_common.py
import locale
import os
......
Subproject commit 34784b7a617aa35d3b994c9f0795567afc6fb0b0
Subproject commit 095f8681dbdfd2e9247446822e953287c9bca66c
......@@ -29,7 +29,7 @@ import time
from ansible import constants as C
from ansible.errors import AnsibleError
from ansible.executor.module_common import ModuleReplacer
from ansible.executor.module_common import modify_module
from ansible.parsing.utils.jsonify import jsonify
from ansible.plugins import shell_loader
......@@ -78,7 +78,7 @@ class ActionBase:
def _configure_module(self, module_name, module_args):
'''
Handles the loading and templating of the module code through the
ModuleReplacer class.
modify_module() function.
'''
# Search module path(s) for named module.
......@@ -94,7 +94,7 @@ class ActionBase:
"run 'git submodule update --init --recursive' to correct this problem." % (module_name))
# insert shared code and arguments into the module
(module_data, module_style, module_shebang) = ModuleReplacer().modify_module(module_path, module_args)
(module_data, module_style, module_shebang) = modify_module(module_path, module_args)
return (module_style, module_shebang, module_data)
......
......@@ -34,8 +34,9 @@ import os
import subprocess
import traceback
import optparse
import ansible.utils as utils
import ansible.module_common as module_common
from ansible import utils
from ansible import module_common
import ansible.constants as C
try:
......@@ -87,8 +88,6 @@ def boilerplate_module(modfile, args, interpreter, check):
#module_data = module_fh.read()
#module_fh.close()
replacer = module_common.ModuleReplacer()
#included_boilerplate = module_data.find(module_common.REPLACER) != -1 or module_data.find("import ansible.module_utils") != -1
complex_args = {}
......@@ -116,7 +115,7 @@ def boilerplate_module(modfile, args, interpreter, check):
if check:
complex_args['CHECKMODE'] = True
(module_data, module_style, shebang) = replacer.modify_module(
(module_data, module_style, shebang) = module_common.modify_module(
modfile,
complex_args,
args,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment