From: Holger Levsen Date: Fri, 1 Jun 2012 13:01:11 +0000 (+0200) Subject: ignore those 6 well known boolean warnings... but fail if there are not exactly 6... X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=db19368f4ad6a82f6c22bb846326b76b317970d1;p=profitbricks%2Fjenkins-build-scripts.git ignore those 6 well known boolean warnings... but fail if there are not exactly 6 in the file we expect --- diff --git a/puppet_lint_run.sh b/puppet_lint_run.sh index ccf0c2a..403e497 100755 --- a/puppet_lint_run.sh +++ b/puppet_lint_run.sh @@ -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