@ -29,9 +29,7 @@ from ansible.utils.sentinel import Sentinel
# modules formated for user msg
# modules formated for user msg
FREEFORM_ACTIONS_SIMPLE = set ( C . MODULE_REQUIRE_ARGS_SIMPLE )
_BUILTIN_RAW_PARAM_MODULES_SIMPLE = set ( [
FREEFORM_ACTIONS = frozenset ( add_internal_fqcns ( FREEFORM_ACTIONS_SIMPLE ) )
RAW_PARAM_MODULES = FREEFORM_ACTIONS_SIMPLE . union ( set ( [
' include_vars ' ,
' include_vars ' ,
' include_tasks ' ,
' include_tasks ' ,
' include_role ' ,
' include_role ' ,
@ -41,9 +39,12 @@ RAW_PARAM_MODULES = FREEFORM_ACTIONS_SIMPLE.union(set([
' group_by ' ,
' group_by ' ,
' set_fact ' ,
' set_fact ' ,
' meta ' ,
' meta ' ,
] ) )
] )
FREEFORM_ACTIONS_SIMPLE = set ( C . MODULE_REQUIRE_ARGS_SIMPLE )
FREEFORM_ACTIONS = frozenset ( C . MODULE_REQUIRE_ARGS )
RAW_PARAM_MODULES_SIMPLE = _BUILTIN_RAW_PARAM_MODULES_SIMPLE . union ( FREEFORM_ACTIONS_SIMPLE )
# For filtering out modules correctly below, use all permutations
# For filtering out modules correctly below, use all permutations
RAW_PARAM_MODULES_MATCH = add_internal_fqcns ( RAW_PARAM_MODULES ) + C . WIN_MOVED
RAW_PARAM_MODULES = frozenset ( add_internal_fqcns ( RAW_PARAM_MODULES _SIMPLE) ) . union ( FREEFORM_ACTIONS )
BUILTIN_TASKS = frozenset ( add_internal_fqcns ( (
BUILTIN_TASKS = frozenset ( add_internal_fqcns ( (
' meta ' ,
' meta ' ,
' include_tasks ' ,
' include_tasks ' ,
@ -352,14 +353,14 @@ class ModuleArgsParser:
else :
else :
raise AnsibleParserError ( " no module/action detected in task. " ,
raise AnsibleParserError ( " no module/action detected in task. " ,
obj = self . _task_ds )
obj = self . _task_ds )
elif args . get ( ' _raw_params ' , ' ' ) != ' ' and action not in RAW_PARAM_MODULES _MATCH :
elif args . get ( ' _raw_params ' , ' ' ) != ' ' and action not in RAW_PARAM_MODULES :
templar = Templar ( loader = None )
templar = Templar ( loader = None )
raw_params = args . pop ( ' _raw_params ' )
raw_params = args . pop ( ' _raw_params ' )
if templar . is_template ( raw_params ) :
if templar . is_template ( raw_params ) :
args [ ' _variable_params ' ] = raw_params
args [ ' _variable_params ' ] = raw_params
else :
else :
raise AnsibleParserError ( " this task ' %s ' has extra params, which is only allowed in the following modules: %s " % ( action ,
raise AnsibleParserError (
" , " . join ( RAW_PARAM_MODULES ) ) ,
" this task ' %s ' has extra params, which is only allowed in the following modules: %s " % ( action , " , " . join ( RAW_PARAM_MODULES _SIMPLE ) ) ,
obj = self . _task_ds )
obj = self . _task_ds )
return ( action , args , delegate_to )
return ( action , args , delegate_to )