I'm using puppet parser validate
in a git pre-commit
hook in order to spot problems before committing files to our Puppet configuration repository. Unfortunately, this command appears to be a very lightweight syntax check that only marks errors such unbalanced quotes and brackets.
The validate
command does not appear to actually parse the configuration and look for things like invalid attributes, undefined references, and so forth. For example, the following will not result in a complaint:
file { 'somefile': requires => File['some-other-file'] }
In this example, requires
should be require
. Similarly, this also generates no errors:
file {'somefile': require => File['file-that-does-not-exist']}
There is no resource definition for file-that-does-not-exist
.
Is there any way to catch these sorts of errors without actually applying the configuration? I was hoping for some sort of flag on the puppet apply
command that would completely parse a configuration without making changes, but as far as I can tell no such option exists in Puppet 2.7.1.
UPDATE
puppet apply --noop
appears to try too hard in the other direction. It will try to stat()
any file referenced in the manifest, which will often cause it to fail with permission errors if it attempts to stat()
a file that is not accessible to the current user.
What are other folks doing?