Skip to content

Commit

Permalink
Compare FQCN also in lockstep logic. Fixes ansible#76782 (ansible#76787)
Browse files Browse the repository at this point in the history
  • Loading branch information
sivel authored and bcoca committed Feb 7, 2022
1 parent fddb547 commit 284386b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
@@ -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)
3 changes: 2 additions & 1 deletion lib/ansible/plugins/callback/default.py
Expand Up @@ -25,6 +25,7 @@
from ansible.playbook.task_include import TaskInclude
from ansible.plugins.callback import CallbackBase
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
# unmodified derivative plugins to work. However, newer options added to the
Expand Down Expand Up @@ -177,7 +178,7 @@ def _task_start(self, task, prefix=None):

# Preserve task name, as all vars may not be available for templating
# 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
# task title from a previous non-free play
self._last_task_name = None
Expand Down
@@ -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

1 change: 1 addition & 0 deletions test/integration/targets/callback_default/runme.sh
Expand Up @@ -237,4 +237,5 @@ rm -f meta_test.out

# 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.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)

0 comments on commit 284386b

Please sign in to comment.