remove properties from vars in include_role (#38968)

* remove properties from vars in include_role
* also from_ args

(cherry picked from commit b9f7f582d1)
pull/40008/head
Brian Coca 7 years ago
parent 82abfa7ddf
commit 0cd5457ea2

@ -0,0 +1,2 @@
- bugfixes:
- disambiguate keywords from variables in include_role https://github.com/ansible/ansible/pull/38968

@ -142,7 +142,7 @@ class IncludedFile:
inc_file = IncludedFile(include_file, include_variables, original_task) inc_file = IncludedFile(include_file, include_variables, original_task)
else: else:
# template the included role's name here # template the included role's name here
role_name = include_variables.get('name', include_variables.get('role', None)) role_name = include_variables.pop('name', include_variables.pop('role', None))
if role_name is not None: if role_name is not None:
role_name = templar.template(role_name) role_name = templar.template(role_name)
@ -151,7 +151,7 @@ class IncludedFile:
for from_arg in new_task.FROM_ARGS: for from_arg in new_task.FROM_ARGS:
if from_arg in include_variables: if from_arg in include_variables:
from_key = from_arg.replace('_from', '') from_key = from_arg.replace('_from', '')
new_task._from_files[from_key] = templar.template(include_variables[from_arg]) new_task._from_files[from_key] = templar.template(include_variables.pop(from_arg))
inc_file = IncludedFile("role", include_variables, new_task, is_role=True) inc_file = IncludedFile("role", include_variables, new_task, is_role=True)

Loading…
Cancel
Save