mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
updated to use new loader
This commit is contained in:
parent
d70c88bf8c
commit
2f51f3bbc5
1 changed files with 5 additions and 3 deletions
|
@ -34,7 +34,8 @@ import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import traceback
|
import traceback
|
||||||
import optparse
|
import optparse
|
||||||
import ansible.utils as utils
|
import ansible.utils.vars as utils_vars
|
||||||
|
from ansible.parsing import DataLoader
|
||||||
from ansible.parsing.utils.jsonify import jsonify
|
from ansible.parsing.utils.jsonify import jsonify
|
||||||
from ansible.parsing.splitter import parse_kv
|
from ansible.parsing.splitter import parse_kv
|
||||||
import ansible.executor.module_common as module_common
|
import ansible.executor.module_common as module_common
|
||||||
|
@ -91,17 +92,18 @@ def boilerplate_module(modfile, args, interpreter, check):
|
||||||
#module_fh.close()
|
#module_fh.close()
|
||||||
|
|
||||||
#replacer = module_common.ModuleReplacer()
|
#replacer = module_common.ModuleReplacer()
|
||||||
|
loader = DataLoader()
|
||||||
|
|
||||||
#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("@"):
|
if args.startswith("@"):
|
||||||
# Argument is a YAML file (JSON is a subset of YAML)
|
# 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:]))
|
complex_args = utils_vars.combine_vars(complex_args, loader.load_from_file(args[1:]))
|
||||||
args=''
|
args=''
|
||||||
elif args.startswith("{"):
|
elif args.startswith("{"):
|
||||||
# Argument is a YAML document (not a file)
|
# Argument is a YAML document (not a file)
|
||||||
complex_args = utils.combine_vars(complex_args, utils.parse_yaml(args))
|
complex_args = utils_vars.combine_vars(complex_args, loader.load(args))
|
||||||
args=''
|
args=''
|
||||||
|
|
||||||
inject = {}
|
inject = {}
|
||||||
|
|
Loading…
Reference in a new issue