mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Alternately track listening handlers by uuid if no name is set
Fixes #17846
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
set -eux
|
||||
|
||||
ansible-playbook test_handlers.yml -i inventory.handlers -v "$@" --tags scenario1
|
||||
ansible-playbook test_listening_handlers.yml -i inventory.handlers -v "$@"
|
||||
|
||||
[ "$(ansible-playbook test_handlers.yml -i inventory.handlers -v "$@" --tags scenario2 -l A \
|
||||
| egrep -o 'RUNNING HANDLER \[test_handlers : .*?]')" = "RUNNING HANDLER [test_handlers : test handler]" ]
|
||||
|
||||
@@ -18,6 +18,31 @@
|
||||
- "'handler2_called' in hostvars[inventory_hostname]"
|
||||
tags: ['scenario1']
|
||||
|
||||
- name: verify listening handlers
|
||||
hosts: A
|
||||
gather_facts: False
|
||||
connection: local
|
||||
tasks:
|
||||
- name: notify some handlers
|
||||
command: echo foo
|
||||
notify:
|
||||
- notify_listen
|
||||
post_tasks:
|
||||
- name: assert all defined handlers ran without error
|
||||
assert:
|
||||
that:
|
||||
- "notify_listen_ran_1 is defined"
|
||||
- "notify_listen_ran_2 is defined"
|
||||
handlers:
|
||||
- name: first listening handler has a name
|
||||
set_fact:
|
||||
notify_listen_ran_1: True
|
||||
listen: notify_listen
|
||||
# second listening handler does not
|
||||
- set_fact:
|
||||
notify_listen_ran_2: True
|
||||
listen: notify_listen
|
||||
|
||||
- name: test handlers
|
||||
hosts: testgroup
|
||||
gather_facts: False
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: verify listening handlers
|
||||
hosts: A
|
||||
gather_facts: False
|
||||
connection: local
|
||||
tasks:
|
||||
- name: notify some handlers
|
||||
command: echo foo
|
||||
notify:
|
||||
- notify_listen
|
||||
post_tasks:
|
||||
- name: assert all defined handlers ran without error
|
||||
assert:
|
||||
that:
|
||||
- "notify_listen_ran_1 is defined"
|
||||
- "notify_listen_ran_2 is defined"
|
||||
handlers:
|
||||
- name: first listening handler has a name
|
||||
set_fact:
|
||||
notify_listen_ran_1: True
|
||||
listen: notify_listen
|
||||
# second listening handler does not
|
||||
- set_fact:
|
||||
notify_listen_ran_2: True
|
||||
listen: notify_listen
|
||||
Reference in New Issue
Block a user