summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/handlers
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2022-05-17 17:25:18 +0200
committerGitHub <noreply@github.com>2022-05-17 17:25:18 +0200
commite9af6efee6eb51b4caf89bf9a53ab80b38615e5d (patch)
treeed4fadba101484d8c7c8d75021fe552e332d49c0 /test/integration/targets/handlers
parentUpdate config dumping info to include 'all info' (#77802) (diff)
downloadansible-e9af6efee6eb51b4caf89bf9a53ab80b38615e5d.tar.xz
ansible-e9af6efee6eb51b4caf89bf9a53ab80b38615e5d.zip
Raise a proper error when include/import_role is used as a handler (#77807)
Diffstat (limited to 'test/integration/targets/handlers')
-rwxr-xr-xtest/integration/targets/handlers/runme.sh4
-rw-r--r--test/integration/targets/handlers/test_role_as_handler.yml11
2 files changed, 15 insertions, 0 deletions
diff --git a/test/integration/targets/handlers/runme.sh b/test/integration/targets/handlers/runme.sh
index 7c403b4ea2..0c3120ba3e 100755
--- a/test/integration/targets/handlers/runme.sh
+++ b/test/integration/targets/handlers/runme.sh
@@ -114,3 +114,7 @@ grep out.txt -e "ERROR! The requested handler 'handler name with myvar' was not
grep out.txt -e "\[WARNING\]: Handler 'handler name with {{ test_var }}' is unusable"
[ "$(grep out.txt -ce 'handler ran')" = "0" ]
[ "$(grep out.txt -ce 'handler with var ran')" = "0" ]
+
+# Test include_role and import_role cannot be used as handlers
+ansible-playbook test_role_as_handler.yml "$@" 2>&1 | tee out.txt
+grep out.txt -e "ERROR! Using 'include_role' as a handler is not supported."
diff --git a/test/integration/targets/handlers/test_role_as_handler.yml b/test/integration/targets/handlers/test_role_as_handler.yml
new file mode 100644
index 0000000000..ae67427408
--- /dev/null
+++ b/test/integration/targets/handlers/test_role_as_handler.yml
@@ -0,0 +1,11 @@
+- name: test include_role and import_role cannot be used as handlers
+ hosts: localhost
+ gather_facts: false
+ tasks:
+ - command: "echo"
+ notify:
+ - role_handler
+ handlers:
+ - name: role_handler
+ include_role:
+ name: doesnotmatter_fails_at_parse_time