From dbed05caecd79e106618cee2afa56a42bcc37dbf Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Fri, 7 Feb 2014 13:09:47 -0600 Subject: [PATCH] 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. --- hacking/test-module | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hacking/test-module b/hacking/test-module index cf4b4753900..3f7a8a2d648 100755 --- a/hacking/test-module +++ b/hacking/test-module @@ -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 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 = {} if interpreter: if '=' not in interpreter: