Correct issue of handlers running on all hosts incorrectly

Also adds an integration test to catch this bug in the future.

Fixes #7559
This commit is contained in:
James Cammarata
2014-05-27 10:55:09 -05:00
parent 617e7eaf5b
commit cfd8c685d1
4 changed files with 24 additions and 9 deletions

View File

@@ -1,3 +1,2 @@
dependencies:
- prepare_tests
dependencies: []

View File

@@ -16,8 +16,23 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
- name: notify the handler
- name: reset handler_called variable to false for all hosts
set_fact:
handler_called: False
- name: notify the handler for host A only
shell: echo
notify:
- set handler fact
when: inventory_hostname == 'A'
- name: force handler execution now
meta: "flush_handlers"
- debug: var=handler_called
- name: validate the handler only ran on one host
assert:
that:
- "inventory_hostname == 'A' and handler_called == True or handler_called == False"