summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/handlers
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2018-05-24 04:03:31 +0200
committerAdam Miller <admiller@redhat.com>2018-05-24 04:03:31 +0200
commit0eece38cdf6eed1358a321fc7887c028ca75e91f (patch)
tree3937962b88e2a8599b41a721af5f1514f1a3e851 /test/integration/targets/handlers
parentUpdate NetApp approvers team (#40505) (diff)
downloadansible-0eece38cdf6eed1358a321fc7887c028ca75e91f.tar.xz
ansible-0eece38cdf6eed1358a321fc7887c028ca75e91f.zip
Fix any_errors_fatal in meta tasks (#36870)
Diffstat (limited to 'test/integration/targets/handlers')
-rwxr-xr-xtest/integration/targets/handlers/runme.sh6
-rw-r--r--test/integration/targets/handlers/test_handlers_any_errors_fatal.yml25
2 files changed, 31 insertions, 0 deletions
diff --git a/test/integration/targets/handlers/runme.sh b/test/integration/targets/handlers/runme.sh
index 726d8094c7..fdeb868275 100755
--- a/test/integration/targets/handlers/runme.sh
+++ b/test/integration/targets/handlers/runme.sh
@@ -57,3 +57,9 @@ grep -q "ERROR! The requested handler 'notify_inexistent_handler' was not found
# Notify inexistent handlers without errors when ANSIBLE_ERROR_ON_MISSING_HANDLER=false
ANSIBLE_ERROR_ON_MISSING_HANDLER=false ansible-playbook test_handlers_inexistent_notify.yml -i inventory.handlers -v "$@"
+# https://github.com/ansible/ansible/issues/36649
+output_dir=/tmp
+set +e
+result="$(ansible-playbook test_handlers_any_errors_fatal.yml -e output_dir=$output_dir -i inventory.handlers -v "$@" 2>&1)"
+set -e
+[ ! -f $output_dir/should_not_exist_B ] || (rm -f $output_dir/should_not_exist_B && exit 1)
diff --git a/test/integration/targets/handlers/test_handlers_any_errors_fatal.yml b/test/integration/targets/handlers/test_handlers_any_errors_fatal.yml
new file mode 100644
index 0000000000..9029443a6f
--- /dev/null
+++ b/test/integration/targets/handlers/test_handlers_any_errors_fatal.yml
@@ -0,0 +1,25 @@
+- hosts:
+ - A
+ - B
+ gather_facts: no
+ any_errors_fatal: yes
+ connection: local
+ vars:
+ output_dir: /tmp
+ tasks:
+ - name: Task one
+ debug:
+ msg: 'task 1'
+ changed_when: yes
+ notify: EXPECTED FAILURE failed_handler
+
+ - meta: flush_handlers
+
+ - name: This task should never happen
+ file:
+ path: "{{ output_dir }}/should_not_exist_{{ inventory_hostname }}"
+ state: touch
+ handlers:
+ - name: EXPECTED FAILURE failed_handler
+ fail:
+ when: 'inventory_hostname == "A"'