Puppet::Tidy - Tidies up your Puppet manifests
use Puppet::Tidy; Puppet::Tidy::puppettidy( source => $source, destination => \@destination );
This module parses the Puppet code and applies a subset of checks from the Puppet Style Guide onto it. Currently the set of checks is rather limited, but already enough is implemented to catch common mistakes and to save you a great deal of time cleaning up your manifests.
The Puppet Style Guide can be found at http://docs.puppetlabs.com/guides/style_guide.html.
Currently the following checks are implemented:
No literal tabs are allowed, this method converts literal tabs to two spaces.
Removes trailing whitespace.
Strings which only contain a variable, mustn't be quoted.
Check for an idiom where reference resource types (File, Package, Group) have a double quoted string as argument. This requires the variable_string() method to be called before.
Resource titles should be single quoted, unless they contain a variable. In which case they should be double quoted.
Attributes should be enclosed in single quotes, unless they contain a variable in which case either double or no quoting is needed.
File modes should be defined using four digits, not three as often done by mistake.
Although Puppet supports C (/**/) and C++ (//) style comments, it's advised to use regular Puppet comments which use a pound sign (#).
Booleans mustn't be quoted, since this means they're not nil, and will thus evaluate to true. These errors are not fixed by Puppet::Tidy since changing 'false' to true actually changing the meaning of a statement. Instead, a warning is inserted into the file.
This module is free software, can you redistribute it and/or modify it under the terms of the ISC license. The full license text can be found in this module's LICENSE file.
Thanks to M:tier Ltd. (http://www.mtier.org/) for sponsoring development of this module.
Jasper Lievisse Adriaanse
To install Puppet::Tidy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Puppet::Tidy
CPAN shell
perl -MCPAN -e shell install Puppet::Tidy
For more information on module installation, please visit the detailed CPAN module installation guide.