mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
ensure if we get a non-Task object in _get_delegated_vars, we return early (#44934)
This commit is contained in:
2
changelogs/fragments/delegate-to-get-vars-no-task.yaml
Normal file
2
changelogs/fragments/delegate-to-get-vars-no-task.yaml
Normal 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)
|
||||||
@@ -487,6 +487,10 @@ class VariableManager:
|
|||||||
return variables
|
return variables
|
||||||
|
|
||||||
def _get_delegated_vars(self, play, task, existing_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,
|
# we unfortunately need to template the delegate_to field here,
|
||||||
# as we're fetching vars before post_validate has been called on
|
# as we're fetching vars before post_validate has been called on
|
||||||
# the task that has been passed in
|
# the task that has been passed in
|
||||||
|
|||||||
@@ -43,3 +43,8 @@
|
|||||||
- include_role2_result is undefined
|
- include_role2_result is undefined
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
|
- include_role:
|
||||||
|
name: include_role
|
||||||
|
apply:
|
||||||
|
delegate_to: testhost2
|
||||||
|
|||||||
Reference in New Issue
Block a user