A collection of task oriented solutions in Puppet

 

Installing puppet-lint plugins

Challenge

Your code runs clean under puppet-lint and you want to check additional things.

Solution

Using nothing but the gem command you can search for available puppet-lint plugins:

# find all the available plugins

$ gem search puppet-lint
... snip ...
puppet-lint-spaceship_operator_without_tag-check (0.1.1)
puppet-lint-strict_indent-check (2.0.5)
puppet-lint-template_file_extension-check (0.1.0)
puppet-lint-top_scope_facts-check (0.0.1)
puppet-lint-trailing_comma-check (0.3.2)
puppet-lint-trailing_newline-check (1.1.0)
... snip ...

Query rubygems to learn a little more about them:

# learn a little more about a gem

$ gem search puppet-lint-yumrepo_gpgcheck_enabled-check -d

*** REMOTE GEMS ***

puppet-lint-yumrepo_gpgcheck_enabled-check (0.0.2)
    Author: Dean Wilson
    Homepage:
      https://github.com/deanwilson/puppet-lint-yumrepo_gpgcheck_enabled-check

    puppet-lint check to ensure gpgcheck is enabled on yumrepo resources

And then install them:

# install it

$ gem install puppet-lint-yumrepo_gpgcheck_enabled-check

Explanation

Once you've installed and run puppet-lint against your modules and cleaned up any stray warnings you might want to become a little more proactive and add some third party checks. These are often a little more niche, opinionated or specific than would be relevant to the core distribution.

There are a few ways to discover the available plugins. The most comprehensive is to query rubygems, as this is the format the plugins are distributed in:

# find all the available plugins

$ gem search puppet-lint
... snip ...
puppet-lint-spaceship_operator_without_tag-check (0.1.1)
puppet-lint-strict_indent-check (2.0.5)
puppet-lint-template_file_extension-check (0.1.0)
puppet-lint-top_scope_facts-check (0.0.1)
puppet-lint-trailing_comma-check (0.3.2)
puppet-lint-trailing_newline-check (1.1.0)
... snip ...

While it's possible to learn about the plugins using the -d (describe) option, shown in the solution above, it's often easier to grab the home page from the output and read more about the checks in a web browser. There are a few good starting points that provide a lot more details about the plugins they offer:

See also