mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07:00
Allowing args: "{{some_var}}"
for task params again
This is unsafe and we debated re-adding it to the v2/2.0 codebase, however it is a common-enough feature that we will simply mark it as deprecated for now and remove it at some point in the future. Fixes #11718
This commit is contained in:
parent
681eab1158
commit
e526743b4f
4 changed files with 27 additions and 4 deletions
|
@ -24,6 +24,7 @@ from six import iteritems, string_types
|
|||
from ansible.errors import AnsibleParserError
|
||||
from ansible.plugins import module_loader
|
||||
from ansible.parsing.splitter import parse_kv, split_args
|
||||
from ansible.template import Templar
|
||||
|
||||
# For filtering out modules correctly below
|
||||
RAW_PARAM_MODULES = ([
|
||||
|
@ -278,7 +279,12 @@ class ModuleArgsParser:
|
|||
if action is None:
|
||||
raise AnsibleParserError("no action detected in task", obj=self._task_ds)
|
||||
elif args.get('_raw_params', '') != '' and action not in RAW_PARAM_MODULES:
|
||||
raise AnsibleParserError("this task '%s' has extra params, which is only allowed in the following modules: %s" % (action, ", ".join(RAW_PARAM_MODULES)), obj=self._task_ds)
|
||||
templar = Templar(loader=None)
|
||||
raw_params = args.pop('_raw_params')
|
||||
if templar._contains_vars(raw_params):
|
||||
args['_variable_params'] = raw_params
|
||||
else:
|
||||
raise AnsibleParserError("this task '%s' has extra params, which is only allowed in the following modules: %s" % (action, ", ".join(RAW_PARAM_MODULES)), obj=self._task_ds)
|
||||
|
||||
# shell modules require special handling
|
||||
(action, args) = self._handle_shell_weirdness(action, args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue