Compare FQCN also in lockstep logic. Fixes #76782 (#76787)

pull/76793/head
Matt Martz 4 years ago committed by GitHub
parent 6de06377d0
commit 29bdb8bf1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,4 @@
bugfixes:
- default callback - Ensure we compare FQCN also in lockstep logic, to ensure
using the FQCN of a strategy plugin triggers the correct behavior in the
default callback plugin. (https://github.com/ansible/ansible/issues/76782)

@ -25,6 +25,7 @@ from ansible import context
from ansible.playbook.task_include import TaskInclude from ansible.playbook.task_include import TaskInclude
from ansible.plugins.callback import CallbackBase from ansible.plugins.callback import CallbackBase
from ansible.utils.color import colorize, hostcolor from ansible.utils.color import colorize, hostcolor
from ansible.utils.fqcn import add_internal_fqcns
# These values use ansible.constants for historical reasons, mostly to allow # These values use ansible.constants for historical reasons, mostly to allow
# unmodified derivative plugins to work. However, newer options added to the # unmodified derivative plugins to work. However, newer options added to the
@ -177,7 +178,7 @@ class CallbackModule(CallbackBase):
# Preserve task name, as all vars may not be available for templating # Preserve task name, as all vars may not be available for templating
# when we need it later # when we need it later
if self._play.strategy in ('free', 'host_pinned'): if self._play.strategy in add_internal_fqcns(('free', 'host_pinned')):
# Explicitly set to None for strategy free/host_pinned to account for any cached # Explicitly set to None for strategy free/host_pinned to account for any cached
# task title from a previous non-free play # task title from a previous non-free play
self._last_task_name = None self._last_task_name = None

@ -0,0 +1,35 @@
PLAY [nonlockstep] *************************************************************
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost10]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost11]
TASK [command] *****************************************************************
changed: [testhost12]
TASK [command] *****************************************************************
changed: [testhost12]
TASK [command] *****************************************************************
changed: [testhost12]
PLAY RECAP *********************************************************************
testhost10 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
testhost11 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
testhost12 : ok=3 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

@ -237,4 +237,5 @@ rm -f meta_test.out
# Ensure free/host_pinned non-lockstep strategies display correctly # Ensure free/host_pinned non-lockstep strategies display correctly
diff -u callback_default.out.free.stdout <(ANSIBLE_STRATEGY=free ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null) diff -u callback_default.out.free.stdout <(ANSIBLE_STRATEGY=free ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null)
diff -u callback_default.out.fqcn_free.stdout <(ANSIBLE_STRATEGY=ansible.builtin.free ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null)
diff -u callback_default.out.host_pinned.stdout <(ANSIBLE_STRATEGY=host_pinned ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null) diff -u callback_default.out.host_pinned.stdout <(ANSIBLE_STRATEGY=host_pinned ansible-playbook -i inventory test_non_lockstep.yml 2>/dev/null)

Loading…
Cancel
Save