Skip to content

Instantly share code, notes, and snippets.

@bhamilton
Forked from bpholt/puppet-check.sh
Created February 14, 2017 21:54
Show Gist options
  • Select an option

  • Save bhamilton/a44ef4baf97ab70d06de7eddaa8645d7 to your computer and use it in GitHub Desktop.

Select an option

Save bhamilton/a44ef4baf97ab70d06de7eddaa8645d7 to your computer and use it in GitHub Desktop.
Puppet Module Syntax Check, Lint, Run Tests, and ERB Syntax Check. There is almost certainly a better way to do this.
#!/bin/bash
# Run from the base directory of your Puppet module
echo ===================
echo Parser Validation
echo ===================
find . -name "*.pp" | xargs -n 1 -t puppet parser validate
echo ===================
echo Linting
echo ===================
find . -name "*.pp" | xargs -n 1 -t puppet-lint
echo ===================
echo Applying Tests
echo ===================
find tests -name "*.pp" | xargs -n 1 -t puppet apply --noop
echo ===================
echo Checking ERB Syntax
echo ===================
find . -name "*.erb" | xargs -n 1 -t -I \{\} erb -P -x -T '-' \{\} | ruby -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment