How do you do strict variable checking?
As of puppet 3.6, you can enable strict variable checking.
How do you enable it? And what exactly does it do?
I recently wrote a blog article on how to enable strict variable checking.
Basically to use it, add the following environment variable, then run your tests
export STRICT_VARIABLES=yes rake spec
Strict variable checking will cause puppet to throw an error if a variable (or facter fact) is not defined. This prevents hard to troubleshoot errors.
For example, given the puppet code:
notice("download from http://example.com/$::foo/bar")
$::foo is not defined, then puppet could return a result like this:
download from http://example.com//bar
With strict variable checking enabled, puppet would throw a warning.
You can easily enable it in your travis tests like so:
env: - PUPPET_VERSION=3.1.0 FACTER_VERSION=1.7.6 - PUPPET_VERSION=3.4.0 FACTER_VERSION=2.0.2 - PUPPET_VERSION=3.6.0 FACTER_VERSION=2.1.0 - PUPPET_VERSION=3.6.0 FACTER_VERSION=2.1.0 STRICT_VARIABLES=yes
Asked: 2014-10-29 11:06:33 -0500
Seen: 390 times
Last updated: Oct 29 '14