M:Tier's Open Source Projects


Development has been discontinued and has been archived on GitLab.com

Puppet::Tidy

Puppet::Tidy is a Perl module and standalone application to verify that Puppet manifests comply with the Puppet Style Guide.

It was developed after getting bored pretty quickly with manually fixing the warnings emitted by the awesome puppet-lint tool.

Puppet::Tidy can be used as a regular Perl module by including the module and passing parameters directly into the module like:

#!/usr/bin/perl

use strict;
use Puppet::Tidy;

my (@output, $source);

$source = << 'EOP';
  file { 'space': mode => $mode }
EOP

Puppet::Tidy::puppettidy(source => $source, destination => \@output);
	
or be run from the commandline with just a simple puppet-tidy.pl input.pp which will create a cleaned input.pp.tdy file.

README

Please refer to CPAN for the documentation.

Examples

Some examples of Puppet code before and after Puppet::Tidy.
Before:

/* /etc/motd has a weird mode. */
file { "motd": mode => 644 }
	  
After:
# /etc/motd has a weird mode.
file { 'motd': mode => '0644' }
	  
While this probably doesn't seem impressive, Puppet::Tidy makes it very easy to comply with the Puppet Style guide... and removes thousands of Puppet-Lint warnings in just a few seconds. Just give it a try on your own Puppet manifests.

Download

Puppet::Tidy 0.3.3 is available through CPAN.

The sources can also be downloaded from GitLab.

Installation

  • cpan(1)
    $ cpan Puppet::Tidy
  • manually
    $ tar -xvf Puppet-Tidy-0.3.3.tar.gz
    $ cd Puppet-Tidy-0.3.3
    $ perl Makefile.PL
    $ make
    $ make install
  • OpenBSD pkg_add(8)
    # pkg_add p5-Puppet-Tidy

Support

In case you have questions or you need support please contact us at puppet-tidy@support.mtier.org.