mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Port some things in test-module to v2.
In particular, fix arg parsing Fixes #11820
This commit is contained in:
parent
91a77b8603
commit
53ae326603
1 changed files with 8 additions and 5 deletions
|
@ -112,7 +112,11 @@ def boilerplate_module(modfile, args, interpreter, check, destfile):
|
|||
complex_args = utils_vars.combine_vars(complex_args, loader.load(args))
|
||||
args=''
|
||||
|
||||
inject = {}
|
||||
if args:
|
||||
parsed_args = parse_kv(args)
|
||||
complex_args = utils_vars.combine_vars(complex_args, parsed_args)
|
||||
|
||||
task_vars = {}
|
||||
if interpreter:
|
||||
if '=' not in interpreter:
|
||||
print 'interpreter must by in the form of ansible_python_interpreter=/usr/bin/python'
|
||||
|
@ -122,16 +126,15 @@ def boilerplate_module(modfile, args, interpreter, check, destfile):
|
|||
interpreter_type = 'ansible_%s' % interpreter_type
|
||||
if not interpreter_type.endswith('_interpreter'):
|
||||
interpreter_type = '%s_interpreter' % interpreter_type
|
||||
inject[interpreter_type] = interpreter_path
|
||||
task_vars[interpreter_type] = interpreter_path
|
||||
|
||||
if check:
|
||||
complex_args['CHECKMODE'] = True
|
||||
|
||||
(module_data, module_style, shebang) = module_common.modify_module(
|
||||
modfile,
|
||||
modfile,
|
||||
complex_args,
|
||||
args,
|
||||
inject
|
||||
task_vars=task_vars
|
||||
)
|
||||
|
||||
modfile2_path = os.path.expanduser(destfile)
|
||||
|
|
Loading…
Reference in a new issue