We all make mistakes, the trick is to quickly find and fix them.
# if we have this (note the missing comma after mode) in our manifest
file { "/tmp/broken_resource":
mode => 644
owner => "root",
}
# to syntax check it we run
$ puppet --parseonly unixdaemon/manifests/init.pp
# and we get -
err: Could not parse for environment production: Syntax error at 'owner';
expected '}' at /etc/puppet/modules/unixdaemon/manifests/init.pp:5
# check all .pp files
$ find -name '*.pp' | xargs -n 1 -t puppet --parseonly
Finding a typo in your manifest when you’re writing it is much better than discovering it in the puppet master logs. By syntax checking your manifests as you’re working, and always before a commit, you can catch some of the more obvious errors before they escape on to the network.
This is only a basic syntax check, it won’t find misspelled properties or even incorrect resource names.