ansible/ansible — pull request #2874 by ipauldev (2013-05-09 04:06:39+00:00)
Title: Added check for undeclared variables in file templates

Templates can have variables that are not defined. (i.e. it may work with a stage hosts file but a developer may have forgotten to add the variables when using prod hosts). This contribution intends to error when a template variable in a file is seen as undeclared. Fixed some Unicode issues with initial approach and am now checking globals to include things like lookups. Also added a 'conditional' check, defaulted to disabled, so as not to affect existing templates, overridden in ansible.cfg.

For testing - I wasn't sure if you wanted a test case created since it intends to fail the run.. There are no other such existing tests I could find that handle failed playbooks, only successful ones. Related, I'm not sure if KeyError is the best way to handle the failure, and also, when running, it appears to have a status of unreachable instead of failed. If you have suggestions, feel free to add.