When writing code, mistakes are bound to happen. There are several layers to troubleshooting the problems that will occur. In the next three sections, we'll look at some solutions to problems with your code, starting with the simplest layer to fix—the syntax.
The puppet-lint
tool is good at finding problems with style and certain syntax issues. For real syntax problems, Puppet has a built-in validation mode, puppet parser validate
. To validate your code, run puppet parser validate
against your manifest.
For example, the following manifest (validate.pp
) has a syntax error that is easy to make:
1 class validate 2 ( 3 $who = "Me", 4 $where = "Here", 5 ) { 6 file { 'why': 7 path => '/tmp/why' 8 contents => "Por Que Dos?\n", 9 } 10 } 11 include validate
When you run puppet parser validate
against this manifest, you will see the following output:
From the preceding output, we know that we should look at line 8 of the validate...