mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Support for -a to accept a file with test-module
If the CLI value for -a starts with an @, treat it like a file, and dump the contents into complex_args This supports yaml or json.
This commit is contained in:
parent
0bc0315171
commit
dbed05caec
1 changed files with 5 additions and 0 deletions
|
@ -89,6 +89,11 @@ def boilerplate_module(modfile, args, interpreter):
|
||||||
#included_boilerplate = module_data.find(module_common.REPLACER) != -1 or module_data.find("import ansible.module_utils") != -1
|
#included_boilerplate = module_data.find(module_common.REPLACER) != -1 or module_data.find("import ansible.module_utils") != -1
|
||||||
|
|
||||||
complex_args = {}
|
complex_args = {}
|
||||||
|
if args.startswith("@"):
|
||||||
|
# Argument is a YAML file (JSON is a subset of YAML)
|
||||||
|
complex_args = utils.combine_vars(complex_args, utils.parse_yaml_from_file(args[1:]))
|
||||||
|
args=''
|
||||||
|
|
||||||
inject = {}
|
inject = {}
|
||||||
if interpreter:
|
if interpreter:
|
||||||
if '=' not in interpreter:
|
if '=' not in interpreter:
|
||||||
|
|
Loading…
Reference in a new issue