Slinging Puppet code on Windows

(My) Tools of the Trade

If you spend any significant amount of time writing Puppet modules or manifests and adding YAML config data for Hiera, you're going to want some linting and validation tools in your arsenal. Here's mine:

The Base Software

  • Atom - A great editor from the people at Github. Very similar to Sublime in terms of look and feel and supports most of the same features out of the box. Highly extensible with a great community behind it.

  • Ruby for Windows, which includes support for RubyGems.

  • Node.js for Windows.

Atom Packages

  • The atom-alignment package for Atom. Good for getting all your ducks in a row. Or your colons and hash rockets.

  • The language-puppet package for Atom. Provides Puppet DSL syntax highlighting and validation.

  • The language-yaml package for Atom. Provides syntax checking and highlighting for YAML files (i.e. your Hiera data)

  • The linter package to support the linter packages that use it.

  • The linter-puppet-lint package to lint your Puppet code for stuff that doesn't conform to the style guide. Requires the puppet-lint Ruby Gem.

  • The linter-js-yaml package for Atom, for linting your YAML files through the js-yaml Node.js package.

Ruby Gems

  • The puppet-lint RubyGem to support the Atom Puppet linter.

  • The hiera RubyGem. Not required for editing but useful for running local Hiera lookups. This has the following dependencies on Windows:

Node.js Packages

  • The js-yaml package to support the Atom YAML linter.

Finally, make sure your whitespace is visible. YAML in particular is extremely sensitive to hard tabs as opposed to spaces, or improper indentation of hashes. Badly formatted YAML can easily break a Puppet run by causing Hiera lookups to fail.

And there you have it... almost. The missing piece of the puzzle is implementing a Git commit hook that invokes rspec-puppet or something similar that will perform unit testing on Puppet modules before they will be committed to the repository. I have yet to solve that one. If you know of a way, let me know!