From 7a8c5fe53b6ce2cfefd8ad2d728db0568f1ac5b4 Mon Sep 17 00:00:00 2001 From: Patrick Otto Date: Tue, 26 Jul 2011 13:59:46 +0200 Subject: [PATCH 1/5] completion for signing requests --- puppetca-bash_completion.d | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/puppetca-bash_completion.d b/puppetca-bash_completion.d index 4df6d01..dc0df92 100644 --- a/puppetca-bash_completion.d +++ b/puppetca-bash_completion.d @@ -12,6 +12,11 @@ _puppetca() return 0 fi + if [[ ${prev} == "--sign" ]] ; then + COMPREPLY=( $( compgen -W "$( ls /var/lib/puppet/ssl/ca/requests/*.pem 2>/dev/null | xargs -I {} basename {} .pem)" -- ${cur} ) ) + return 0 + fi + if [[ ${prev} == "--clean" ]] ; then COMPREPLY=( $( compgen -W "$( ls /var/lib/puppet/ssl/ca/signed/*.pem 2>/dev/null | xargs -I {} basename {} .pem )" -- ${cur} ) ) return 0 From 279b127e47d9a27dcbb233859776365ddd60a0d1 Mon Sep 17 00:00:00 2001 From: Patrick Otto Date: Tue, 26 Jul 2011 13:59:56 +0200 Subject: [PATCH 2/5] also complete for puppet cert --- puppetca-bash_completion.d | 1 + 1 file changed, 1 insertion(+) diff --git a/puppetca-bash_completion.d b/puppetca-bash_completion.d index dc0df92..49b38cc 100644 --- a/puppetca-bash_completion.d +++ b/puppetca-bash_completion.d @@ -30,3 +30,4 @@ _puppetca() } complete -F _puppetca puppetca +complete -F _puppetca puppet cert From 5b7d7aea3259c7556418d69f6e6b33542e6edbc6 Mon Sep 17 00:00:00 2001 From: Patrick Otto Date: Fri, 9 Sep 2011 16:26:38 +0200 Subject: [PATCH 3/5] simple runner for puppet-lint to use in jenkins --- puppet-lint | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 puppet-lint diff --git a/puppet-lint b/puppet-lint new file mode 100755 index 0000000..e2a2c3d --- /dev/null +++ b/puppet-lint @@ -0,0 +1,29 @@ +#!/bin/bash + +### +## puppet-lint.sh :: run puppet-lint in jenkins +# + +LINT="/var/lib/gems/1.8/bin/puppet-lint" + +find $1 -iname "*pp" | while read file; do + _TMP=$(mktemp -p /tmp/ puppet-lint.XXXX) + echo "# puppet-lint ${file}" + ${LINT} ${file} > ${_TMP} + + _WARN=$(grep ^WARNING ${_TMP} | wc -l) + _ERR=$(grep ^ERROR ${_TMP} | wc -l) + + if [ ${_WARN} -ge 1 ]; then + echo "Warnings from puppet-lint for ${file}:" + grep ^WARNING ${_TMP} + fi + + if [ ${_ERR} -ge 1 ]; then + echo "Errors from puppet-lint for ${file}" + grep ^ERROR ${_TMP} + fi + + rm ${_TMP} + test ${_ERR} -ge 1 && exit 1 +done From 26345933a40fde36f3929781b3c91d3726566f30 Mon Sep 17 00:00:00 2001 From: codec Date: Sun, 11 Sep 2011 13:03:53 +0200 Subject: [PATCH 4/5] correct argument passing --- puppet-lint | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/puppet-lint b/puppet-lint index e2a2c3d..05b9ed1 100755 --- a/puppet-lint +++ b/puppet-lint @@ -6,10 +6,10 @@ LINT="/var/lib/gems/1.8/bin/puppet-lint" -find $1 -iname "*pp" | while read file; do +find "$*" -iname "*pp" | while read file; do _TMP=$(mktemp -p /tmp/ puppet-lint.XXXX) echo "# puppet-lint ${file}" - ${LINT} ${file} > ${_TMP} + ${LINT} "${file}" > ${_TMP} _WARN=$(grep ^WARNING ${_TMP} | wc -l) _ERR=$(grep ^ERROR ${_TMP} | wc -l) From c6412ca3aaf48f4d5f4966639df132c03061111c Mon Sep 17 00:00:00 2001 From: Roger Barnes Date: Thu, 24 Nov 2011 10:28:28 +1100 Subject: [PATCH 5/5] Changed the error/warning output to include parseable filename, put an explicit exit 0 at the end (otherwise last test ${_ERR} -ge 1 result gets passed back. The jenkins parser settings for identifying the warning/error lines with the "Compiler Warnings" plugin: regex: ^\s*(.*) *(WARNING|ERROR): (.* line (\d+).*)\s*$ mapping script: import hudson.plugins.warnings.parser.Warning String fileName = matcher.group(1) String category = matcher.group(3).replaceAll("(on)? line \\d+", "") String message = matcher.group(3) String lineNumber = matcher.group(4) return new Warning(fileName, Integer.parseInt(lineNumber), "puppet-lint", category, message); example log message: modules/tomcat/manifests/sunjdk.pp WARNING: double quoted string containing no variables on line 48 --- puppet-lint | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/puppet-lint b/puppet-lint index 05b9ed1..425e15b 100755 --- a/puppet-lint +++ b/puppet-lint @@ -6,7 +6,7 @@ LINT="/var/lib/gems/1.8/bin/puppet-lint" -find "$*" -iname "*pp" | while read file; do +find "$1" -iname "*pp" | while read file; do _TMP=$(mktemp -p /tmp/ puppet-lint.XXXX) echo "# puppet-lint ${file}" ${LINT} "${file}" > ${_TMP} @@ -16,14 +16,15 @@ find "$*" -iname "*pp" | while read file; do if [ ${_WARN} -ge 1 ]; then echo "Warnings from puppet-lint for ${file}:" - grep ^WARNING ${_TMP} - fi + grep ^WARNING ${_TMP} | awk "{ print \"${file#$1/}\", \$0 }" +fi if [ ${_ERR} -ge 1 ]; then echo "Errors from puppet-lint for ${file}" - grep ^ERROR ${_TMP} + grep ^ERROR ${_TMP} | awk "{ print \"${file#$1/}\", \$0 }" fi rm ${_TMP} test ${_ERR} -ge 1 && exit 1 done +exit 0