Checking your manifests with puppet-lint
The Puppet Labs official style guide outlines a number of style conventions for Puppet code, some of which we've touched on in the preceding section. For example, according to the style guide, manifests:
Must use two-space soft tabs
Must not use literal tab characters
Must not contain trailing white space
Should not exceed an 80 character line width
Should align parameter arrows (
=>
) within blocks
Following the style guide will make sure that your Puppet code is easy to read and maintain and, if you're planning to release your code to the public, style compliance is essential. The puppet-lint
tool will automatically check your code against the style guide. Here's how to use it:
Getting ready
Here's what you need to do to install puppet-lint
:
Run the following command (we'll install
puppet-lint
as a gem, because that version is much more up-to-date than the APT package available in the Ubuntu Precise repo):ubuntu@cookbook:~/puppet$ sudo gem install puppet...