@ -43,10 +43,10 @@ class IncludeRole(TaskInclude):
circumstances related to the ` - include_role : . . . `
circumstances related to the ` - include_role : . . . `
"""
"""
BASE = frozenset ( [ ' name ' , ' role ' ] ) # directly assigned
BASE = ( ' name ' , ' role ' ) # directly assigned
FROM_ARGS = frozenset ( [ ' tasks_from ' , ' vars_from ' , ' defaults_from ' ] ) # used to populate from dict in role
FROM_ARGS = ( ' tasks_from ' , ' vars_from ' , ' defaults_from ' ) # used to populate from dict in role
OTHER_ARGS = frozenset ( [ ' private ' , ' allow_duplicates ' ] ) # assigned to matching property
OTHER_ARGS = ( ' private ' , ' allow_duplicates ' ) # assigned to matching property
VALID_ARGS = frozenset( BASE . union ( FROM_ARGS . union ( OTHER_ARGS ) ) ) # all valid args
VALID_ARGS = tuple( frozenset ( BASE + FROM_ARGS + OTHER_ARGS ) ) # all valid args
# =================================================================================
# =================================================================================
# ATTRIBUTES
# ATTRIBUTES
@ -118,12 +118,12 @@ class IncludeRole(TaskInclude):
raise AnsibleParserError ( ' Invalid options for include_role: %s ' % ' , ' . join ( list ( bad_opts ) ) )
raise AnsibleParserError ( ' Invalid options for include_role: %s ' % ' , ' . join ( list ( bad_opts ) ) )
# build options for role includes
# build options for role includes
for key in IncludeRole. FROM_ARGS . intersection ( my_arg_names ) :
for key in my_arg_names. intersection ( IncludeRole . FROM_ARGS ) :
from_key = key . replace ( ' _from ' , ' ' )
from_key = key . replace ( ' _from ' , ' ' )
ir . _from_files [ from_key ] = basename ( ir . args . get ( key ) )
ir . _from_files [ from_key ] = basename ( ir . args . get ( key ) )
# manual list as otherwise the options would set other task parameters we don't want.
# manual list as otherwise the options would set other task parameters we don't want.
for option in IncludeRole. OTHER_ARGS . intersection ( my_arg_names ) :
for option in my_arg_names. intersection ( IncludeRole . OTHER_ARGS ) :
setattr ( ir , option , ir . args . get ( option ) )
setattr ( ir , option , ir . args . get ( option ) )
return ir
return ir