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.
This commit is contained in:
Petr Svoboda 2013-07-22 16:23:19 +02:00 committed by James Cammarata
parent fff4f1da33
commit e3adfbf5f8
5 changed files with 67 additions and 1 deletions

View file

@ -312,7 +312,8 @@ class PlayBook(object):
conditional=task.only_if, callbacks=self.runner_callbacks,
sudo=task.sudo, sudo_user=task.sudo_user,
transport=task.transport, sudo_pass=task.sudo_pass, is_playbook=True,
check=self.check, diff=self.diff, environment=task.environment, complex_args=task.args
check=self.check, diff=self.diff, environment=task.environment, complex_args=task.args,
error_on_undefined_vars=C.DEFAULT_UNDEFINED_VAR_BEHAVIOR
)
if task.async_seconds == 0: