#!/bin/bash
# copyright 2012 Holger Levsen GPL2 licenced, holger@layer-acht.org
-for file in $(find . -iname '*.pp'); do
- puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1;
-done;
+OUTPUT=$(mktemp)
-find . -iname *.pp -exec puppet-lint --no-80chars-check --log-format "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" {} \;
+for file in $(find . -iname '*.pp') ; do
+ echo "parsing $file"
+ #
+ # first check for blatant errors which immediatly cause failure
+ #
+ puppet parser validate --color false --render-as s --modulepath=modules $file || exit 1
+ #
+ # now run puppet-lint on it and save the output
+ #
+ puppet-lint --no-80chars-check --log-format "%{path}:%{linenumber}:%{check}:%{KIND}:%{message}" $file >$OUTPUT 2>&1
+ # if there is output...
+ if [ -s $OUTPUT ] ; then
+ #
+ # give special treatment to 6 well known boolean warning we want to ignore
+ #
+ if [ "$file" = "./modules/concat/manifests/init.pp" ] ; then
+ if [ $(grep -c "WARNING:quoted boolean value found" $OUTPUT) != "6" ] ; then
+ cat $OUTPUT
+ echo
+ echo "Not exactly 6 boolean warnings found... please investigate and adopt jenkins_build_script.git/puppet_lint_run.sh as needed"
+ exit 1
+ fi
+ fi
+ cat $OUTPUT
+ rm $OUTPUT
+ fi
+done
+rm -f $OUTPUT