Logging debug messages

The truth will make you free. It can be very helpful when debugging problems if you can print out information at a certain point in the manifest. This is a good way to tell, for example, if a variable isn't defined or has an unexpected value. Sometimes it's useful just to know that a particular piece of code has been run. Puppet's notify resource lets you print out such messages.

How to do it…

Define a notify resource in your manifest at the point you want to investigate:

notify { "Got this far!": }

How it works…

When this resource is compiled Puppet will print out the message:

notice: Got this far!

There's more…

If you're the kind of brave soul who likes experimenting, and I hope you are, you'll probably find yourself using debug ...

Get Puppet 2.7 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.