mirror of https://github.com/ansible/ansible.git
Don't skip conditional exception on includes (#39377)
* task_executor.py: Raise 'conditional exception' in case of 'include_*' Fixes #33632 Signed-off-by: Patrick Ringl <patrick_@freenet.de> * Re-organize tests, add static include test with undefined var * Remove unnecessary conditionalpull/35163/merge
parent
05830658bc
commit
2f5161628a
@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
- debug:
|
||||
msg: "This message comes from an 'include_tasks'-task! :-)"
|
||||
register: "_include_tasks_task_result"
|
@ -0,0 +1,5 @@
|
||||
- vars:
|
||||
_undefined: 'yes'
|
||||
block:
|
||||
- set_fact:
|
||||
_include_defined_result: 'good'
|
@ -0,0 +1,36 @@
|
||||
---
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- include_tasks: "include_tasks.yml"
|
||||
ignore_errors: True
|
||||
register: "_include_tasks_result"
|
||||
when:
|
||||
- "_undefined == 'yes'"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "_include_tasks_result is failed"
|
||||
- "_include_tasks_task_result is not defined"
|
||||
msg: "'include_tasks' did not evaluate it's attached condition and failed"
|
||||
|
||||
- include_role:
|
||||
name: "no_log"
|
||||
ignore_errors: True
|
||||
register: "_include_role_result"
|
||||
when:
|
||||
- "_undefined == 'yes'"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "_include_role_result is failed"
|
||||
msg: "'include_role' did not evaluate it's attached condition and failed"
|
||||
|
||||
- include: include_that_defines_var.yml
|
||||
static: yes
|
||||
when:
|
||||
- "_undefined == 'yes'"
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- _include_defined_result == 'good'
|
Loading…
Reference in New Issue