Fix broken callback dispatch on skipped meta tasks (#86977) (#86979)

* Fix broken callback dispatch on skipped meta tasks

(cherry picked from commit cb535cf3d3)

Co-authored-by: Matt Davis <6775756+nitzmahone@users.noreply.github.com>
This commit is contained in:
Patrick Kingston
2026-06-08 14:31:52 -05:00
committed by GitHub
co-authored by Matt Davis
parent 37f63c8eac
commit 34458fbadc
4 changed files with 15 additions and 4 deletions
@@ -0,0 +1,3 @@
bugfixes:
- meta pseudo-action - Fixed callback args passed to ``v2_runner_on_skipped`` when any ``meta`` action was skipped by a ``when`` condition; added test coverage.
A previous regression caused the callback dispatch to be omitted and a warning issued.
+5 -3
View File
@@ -1016,10 +1016,12 @@ class StrategyBase:
else:
display.vv(f"META: {header}")
if skipped:
self._tqm.send_callback('v2_runner_on_skipped', target_host, task, utr)
htr = HostTaskResult(host=target_host, task=task, utr=utr)
return [HostTaskResult(host=target_host, task=task, utr=utr)]
if skipped:
self._tqm.send_callback('v2_runner_on_skipped', htr)
return [htr]
def _get_cached_role(self, task, play):
return play._get_cached_role(task._role)
+3 -1
View File
@@ -40,8 +40,10 @@ done
# test end_play meta task
for test_strategy in linear free; do
out="$(ansible-playbook test_end_play.yml -i inventory.yml -e test_strategy=$test_strategy -vv "$@")"
# $@ omitted to avoid additional verbosity, which will line-break and indent the JSON output we need to check
out="$(ansible-playbook test_end_play.yml -i inventory.yml -e test_strategy=$test_strategy -vv)"
grep -q "skipping:.*end_play conditional evaluated to False, continuing play" <<< "$out"
grep -q "META: ending play" <<< "$out"
grep -qv 'Failed to end using end_play' <<< "$out"
@@ -3,6 +3,10 @@
gather_facts: no
strategy: "{{ test_strategy | default('linear') }}"
tasks:
- name: Skipped end_play
meta: end_play
when: false
- debug:
msg: "Testing end_play on host {{ inventory_hostname }}"