]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
ignore those 6 well known boolean warnings... but fail if there are not exactly 6...
authorHolger Levsen <holger@layer-acht.org>
Fri, 1 Jun 2012 13:01:11 +0000 (15:01 +0200)
committerHolger Levsen <holger@layer-acht.org>
Fri, 1 Jun 2012 13:01:11 +0000 (15:01 +0200)
puppet_lint_run.sh

index ccf0c2ac0d55ba70549cc4dc9d064ff46f3ab548..403e497345811f9d15f891756c3daed9d65ea7fb 100755 (executable)
@@ -1,8 +1,33 @@
 #!/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