mirror of
https://github.com/ansible/ansible.git
synced 2026-02-03 20:40:24 -05:00
async_status: inherit delegate_to from original task
Fixes #86491 ci_complete
This commit is contained in:
parent
7f7884fc4f
commit
c31a479ab0
5 changed files with 24 additions and 0 deletions
|
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- Fix interpreter discovery on delegated ``async`` tasks (https://github.com/ansible/ansible/issues/86491)
|
||||
|
|
@ -879,6 +879,7 @@ class TaskExecutor:
|
|||
args={'jid': async_jid},
|
||||
check_mode=self._task.check_mode,
|
||||
environment=self._task.environment,
|
||||
delegate_to=self._task.delegate_to,
|
||||
))
|
||||
|
||||
# ensure that the synthetic async task has the resolved connection recorded on it
|
||||
|
|
@ -956,6 +957,7 @@ class TaskExecutor:
|
|||
},
|
||||
'check_mode': self._task.check_mode,
|
||||
'environment': self._task.environment,
|
||||
'delegate_to': self._task.delegate_to,
|
||||
}
|
||||
)
|
||||
cleanup_handler = self._shared_loader_obj.action_loader.get(
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ ansible-playbook delegate_local_from_root.yml -i inventory -v "$@" -e 'ansible_u
|
|||
ansible-playbook delegate_with_fact_from_delegate_host.yml "$@"
|
||||
ansible-playbook delegate_facts_loop.yml -i inventory -v "$@"
|
||||
ansible-playbook test_random_delegate_to_with_loop.yml -i inventory -v "$@"
|
||||
ansible-playbook test_delegated_async.yml -v "$@"
|
||||
|
||||
# Run playbook multiple times to ensure there are no false-negatives
|
||||
for i in $(seq 0 10); do ansible-playbook test_random_delegate_to_without_loop.yml -i inventory -v "$@"; done;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
- name: test delegated async
|
||||
hosts: localhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- command: ansible-playbook test_delegated_async_inner.yml -i inventory_interpreters -vvv
|
||||
register: r
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- r.stdout | regex_findall('firstpython') | length == 0
|
||||
- r.stdout | regex_findall('secondpython') | length >= 3 # tasks: wrapper, cleanup and at least one status
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
- name: test delegated async
|
||||
hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- command: sleep 3
|
||||
delegate_to: testhost2
|
||||
async: 5
|
||||
poll: 1
|
||||
Loading…
Reference in a new issue