O'Reilly logo

Troubleshooting Puppet by Thomas Uphill

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing code

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.

Validating code

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", ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required