ensure if we get a non-Task object in _get_delegated_vars, we return early (#44934)

This commit is contained in:
Matt Martz 2018-08-30 17:11:32 -05:00 committed by GitHub
parent 3550f342e0
commit 2a4e92aab7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- delegate_to - ensure if we get a non-Task object in _get_delegated_vars, we return early (https://github.com/ansible/ansible/pull/44934)

View file

@ -487,6 +487,10 @@ class VariableManager:
return variables
def _get_delegated_vars(self, play, task, existing_variables):
if not hasattr(task, 'loop'):
# This "task" is not a Task, so we need to skip it
return {}
# we unfortunately need to template the delegate_to field here,
# as we're fetching vars before post_validate has been called on
# the task that has been passed in

View file

@ -43,3 +43,8 @@
- include_role2_result is undefined
tags:
- always
- include_role:
name: include_role
apply:
delegate_to: testhost2