mirror of https://github.com/ansible/ansible.git
Add tests for undefined variable detection
Tests `test_playbook_undefined_varsX_fail` check if ansible detects undefined variables when `error_on_undefined_vars` is enabled. These tests fail without "Improve behavior with error_on_undefined_vars enabled" patch. Tests `test_playbook_undefined_varsX_ignore` check if ansible ignores undefined variables when `error_on_undefined_vars` is disabled. Also modify PlayBook._run_task_internal() so error_on_undefined_vars is testable.pull/3624/merge
parent
fff4f1da33
commit
e3adfbf5f8
@ -0,0 +1,5 @@
|
||||
localhost
|
||||
|
||||
[all:vars]
|
||||
inventory_var_good="{{ playbook_var_good }}"
|
||||
inventory_var_bad="{{ playbook_var_bad }}"
|
@ -0,0 +1,7 @@
|
||||
- hosts: all
|
||||
vars:
|
||||
playbook_var_good: "ok"
|
||||
playbook_var_bad: "{{ undefined_var }}"
|
||||
tasks:
|
||||
- debug: msg="{{ playbook_var_good }}"
|
||||
- debug: msg="{{ playbook_var_bad }}"
|
@ -0,0 +1,7 @@
|
||||
- hosts: all
|
||||
vars:
|
||||
playbook_var_good: "ok"
|
||||
playbook_var_bad: "{{ undefined_var }}"
|
||||
tasks:
|
||||
- debug: msg="{{ inventory_var_good }}"
|
||||
- debug: msg="{{ inventory_var_bad }}"
|
Loading…
Reference in New Issue