Skip to content

Commit

Permalink
Port some things in test-module to v2.
Browse files Browse the repository at this point in the history
In particular, fix arg parsing

Fixes ansible#11820
  • Loading branch information
abadger committed Aug 1, 2015
1 parent 91a77b8 commit 53ae326
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hacking/test-module
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
Expand Down

0 comments on commit 53ae326

Please sign in to comment.