|
|
|
@ -37,6 +37,7 @@ from ansible import constants as C
|
|
|
|
|
from ansible.errors import AnsibleError
|
|
|
|
|
from ansible.executor.interpreter_discovery import InterpreterDiscoveryRequiredError
|
|
|
|
|
from ansible.executor.powershell import module_manifest as ps_manifest
|
|
|
|
|
from ansible.module_utils.common.json import AnsibleJSONEncoder
|
|
|
|
|
from ansible.module_utils.common.text.converters import to_bytes, to_text, to_native
|
|
|
|
|
from ansible.plugins.loader import module_utils_loader
|
|
|
|
|
from ansible.utils.collection_loader._collection_finder import _get_collection_metadata, AnsibleCollectionRef
|
|
|
|
@ -1075,7 +1076,7 @@ def _find_module_utils(module_name, b_module_data, module_path, module_args, tas
|
|
|
|
|
if module_substyle == 'python':
|
|
|
|
|
params = dict(ANSIBLE_MODULE_ARGS=module_args,)
|
|
|
|
|
try:
|
|
|
|
|
python_repred_params = repr(json.dumps(params))
|
|
|
|
|
python_repred_params = repr(json.dumps(params, cls=AnsibleJSONEncoder, vault_to_text=True))
|
|
|
|
|
except TypeError as e:
|
|
|
|
|
raise AnsibleError("Unable to pass options to module, they must be JSON serializable: %s" % to_native(e))
|
|
|
|
|
|
|
|
|
@ -1256,7 +1257,7 @@ def _find_module_utils(module_name, b_module_data, module_path, module_args, tas
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
elif module_substyle == 'jsonargs':
|
|
|
|
|
module_args_json = to_bytes(json.dumps(module_args))
|
|
|
|
|
module_args_json = to_bytes(json.dumps(module_args, cls=AnsibleJSONEncoder, vault_to_text=True))
|
|
|
|
|
|
|
|
|
|
# these strings could be included in a third-party module but
|
|
|
|
|
# officially they were included in the 'basic' snippet for new-style
|
|
|
|
|