From ad595eadeaa24d7d2bf1c4769382a87ca755876d Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Thu, 15 Aug 2013 09:25:29 -0500 Subject: [PATCH] Enable error_on_undefined_vars by default --- CHANGELOG.md | 1 + examples/ansible.cfg | 7 ++++--- lib/ansible/constants.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b7231c64d5..cea3231b219 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Highlighted new features: * --extra-vars can now take a file as input "-e @filename" * external inventory scripts may now return host variables in one pass, which allows them to be much more efficient for large numbers of hosts * if --forks exceeds the numbers of hosts, it will be automatically reduced, set forks to 0 and you get "as many forks as I have hosts" out of the box. +* enabling error_on_undefined_vars by default, which will make errors in playbooks more obvious New modules: diff --git a/examples/ansible.cfg b/examples/ansible.cfg index 9818959757f..acedfb9cda1 100644 --- a/examples/ansible.cfg +++ b/examples/ansible.cfg @@ -72,9 +72,10 @@ timeout = 10 # replacing {file}, {host} and {uid} and strftime codes with proper values. ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host} -# if set, Ansible will raise errors when attempting to redeference Jinja2 -# variables that are not set in templates or action lines. -#error_on_undefined_vars = True +# by default (as of 1.3), Ansible will raise errors when attempting to dereference +# Jinja2 variables that are not set in templates or action lines. Uncomment this line +# to revert the behavior to pre-1.3. +#error_on_undefined_vars = False # set plugin path directories here, seperate with colons action_plugins = /usr/share/ansible_plugins/action_plugins diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index dc788b71e89..80d81f5b0db 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -133,7 +133,7 @@ ANSIBLE_SSH_ARGS = get_config(p, 'ssh_connection', 'ssh_args', 'AN PARAMIKO_RECORD_HOST_KEYS = get_config(p, 'paramiko_connection', 'record_host_keys', 'ANSIBLE_PARAMIKO_RECORD_HOST_KEYS', True, boolean=True) ZEROMQ_PORT = int(get_config(p, 'fireball_connection', 'zeromq_port', 'ANSIBLE_ZEROMQ_PORT', 5099)) -DEFAULT_UNDEFINED_VAR_BEHAVIOR = get_config(p, DEFAULTS, 'error_on_undefined_vars', 'ANSIBLE_ERROR_ON_UNDEFINED_VARS', False, boolean=True) +DEFAULT_UNDEFINED_VAR_BEHAVIOR = get_config(p, DEFAULTS, 'error_on_undefined_vars', 'ANSIBLE_ERROR_ON_UNDEFINED_VARS', True, boolean=True) HOST_KEY_CHECKING = get_config(p, DEFAULTS, 'host_key_checking', 'ANSIBLE_HOST_KEY_CHECKING', True, boolean=True) # non-configurable things