mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 00:22:10 +02:00
core: raw params better error msg (#83726)
* less confusing error msg * also remove 'removed' include
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- the raw arguments error now just displays the short names of modules instead of every possible variation
|
||||
@@ -176,10 +176,10 @@ INTERNAL_STATIC_VARS = frozenset(
|
||||
]
|
||||
)
|
||||
LOCALHOST = ('127.0.0.1', 'localhost', '::1')
|
||||
MODULE_REQUIRE_ARGS = tuple(add_internal_fqcns(('command', 'win_command', 'ansible.windows.win_command', 'shell', 'win_shell',
|
||||
'ansible.windows.win_shell', 'raw', 'script')))
|
||||
MODULE_NO_JSON = tuple(add_internal_fqcns(('command', 'win_command', 'ansible.windows.win_command', 'shell', 'win_shell',
|
||||
'ansible.windows.win_shell', 'raw')))
|
||||
WIN_MOVED = ['ansible.windows.win_command', 'ansible.windows.win_shell']
|
||||
MODULE_REQUIRE_ARGS_SIMPLE = ['command', 'raw', 'script', 'shell', 'win_command', 'win_shell']
|
||||
MODULE_REQUIRE_ARGS = tuple(add_internal_fqcns(MODULE_REQUIRE_ARGS_SIMPLE) + WIN_MOVED)
|
||||
MODULE_NO_JSON = tuple(add_internal_fqcns(('command', 'win_command', 'shell', 'win_shell', 'raw')) + WIN_MOVED)
|
||||
RESTRICTED_RESULT_KEYS = ('ansible_rsync_path', 'ansible_playbook_python', 'ansible_facts')
|
||||
SYNTHETIC_COLLECTIONS = ('ansible.builtin', 'ansible.legacy')
|
||||
TREE_DIR = None
|
||||
|
||||
@@ -28,11 +28,9 @@ from ansible.utils.fqcn import add_internal_fqcns
|
||||
from ansible.utils.sentinel import Sentinel
|
||||
|
||||
|
||||
# For filtering out modules correctly below
|
||||
FREEFORM_ACTIONS = frozenset(C.MODULE_REQUIRE_ARGS)
|
||||
|
||||
RAW_PARAM_MODULES = FREEFORM_ACTIONS.union(add_internal_fqcns((
|
||||
'include',
|
||||
# modules formated for user msg
|
||||
FREEFORM_ACTIONS = set(C.MODULE_REQUIRE_ARGS_SIMPLE)
|
||||
RAW_PARAM_MODULES = FREEFORM_ACTIONS.union(set([
|
||||
'include_vars',
|
||||
'include_tasks',
|
||||
'include_role',
|
||||
@@ -42,8 +40,9 @@ RAW_PARAM_MODULES = FREEFORM_ACTIONS.union(add_internal_fqcns((
|
||||
'group_by',
|
||||
'set_fact',
|
||||
'meta',
|
||||
)))
|
||||
|
||||
]))
|
||||
# For filtering out modules correctly below, use all permutations
|
||||
RAW_PARAM_MODULES_MATCH = add_internal_fqcns(RAW_PARAM_MODULES) + C.WIN_MOVED
|
||||
BUILTIN_TASKS = frozenset(add_internal_fqcns((
|
||||
'meta',
|
||||
'include_tasks',
|
||||
@@ -352,7 +351,7 @@ class ModuleArgsParser:
|
||||
else:
|
||||
raise AnsibleParserError("no module/action detected in task.",
|
||||
obj=self._task_ds)
|
||||
elif args.get('_raw_params', '') != '' and action not in RAW_PARAM_MODULES:
|
||||
elif args.get('_raw_params', '') != '' and action not in RAW_PARAM_MODULES_MATCH:
|
||||
templar = Templar(loader=None)
|
||||
raw_params = args.pop('_raw_params')
|
||||
if templar.is_template(raw_params):
|
||||
|
||||
Reference in New Issue
Block a user