From cd741ab4aa1a6e334b4328ffeffe6766aa8fc376 Mon Sep 17 00:00:00 2001 From: Clemens Bergmann Date: Fri, 14 Sep 2018 07:57:05 +0200 Subject: [PATCH 1/3] r10k ignores PUPPETFILE variable --- commit_hooks/r10k_syntax_check.sh | 4 +++- pre-commit | 2 +- pre-receive | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/commit_hooks/r10k_syntax_check.sh b/commit_hooks/r10k_syntax_check.sh index b820eb9..1dd22ed 100755 --- a/commit_hooks/r10k_syntax_check.sh +++ b/commit_hooks/r10k_syntax_check.sh @@ -3,7 +3,9 @@ # This script assumes you have installed r10k and will perform a syntax check on the Puppetfile if existing echo "Performing a syntax check on the r10k Puppetfile:" -PUPPETFILE="$1" r10k puppetfile check +pushd "$1" >/dev/null +r10k puppetfile check +popd >/dev/null if [[ $? -ne 0 ]] then diff --git a/pre-commit b/pre-commit index 7a0680c..2e48901 100755 --- a/pre-commit +++ b/pre-commit @@ -164,7 +164,7 @@ fi #r10k puppetfile syntax check if hash r10k >/dev/null 2>&1; then if [[ "$changedfile" = "Puppetfile" ]]; then - "${subhook_root}/r10k_syntax_check.sh" + "${subhook_root}/r10k_syntax_check.sh" "${git_root}/" RC=$? if [[ "$RC" -ne 0 ]]; then failures=$((failures + 1)) diff --git a/pre-receive b/pre-receive index 20ccc23..db5d82b 100755 --- a/pre-receive +++ b/pre-receive @@ -150,7 +150,7 @@ while read -r oldrev newrev refname; do #r10k puppetfile syntax check if hash r10k >/dev/null 2>&1; then if [ "$changedfile" = "Puppetfile" ]; then - ${subhook_root}/r10k_syntax_check.sh $tmptree/$changedfile + ${subhook_root}/r10k_syntax_check.sh "${tmptree}/" RC=$? if [ "$RC" -ne 0 ]; then failures=`expr $failures + 1` From 49c7d27049abe9aa3e1b214c4a89ff29fcd8d105 Mon Sep 17 00:00:00 2001 From: Clemens Bergmann Date: Fri, 14 Sep 2018 08:50:49 +0200 Subject: [PATCH 2/3] future parser is not possible in puppet 5 --- pre-commit | 2 +- pre-receive | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pre-commit b/pre-commit index 2e48901..8dd9b84 100755 --- a/pre-commit +++ b/pre-commit @@ -50,7 +50,7 @@ fi # Only puppet 3.2.1 - 3.8 support "--parser future" option. case $(puppet --version) in - 4*) USE_PUPPET_FUTURE_PARSER="disabled" ;; + 4*|5*) USE_PUPPET_FUTURE_PARSER="disabled" ;; esac SAVEIFS=$IFS diff --git a/pre-receive b/pre-receive index db5d82b..bb518d3 100755 --- a/pre-receive +++ b/pre-receive @@ -45,7 +45,7 @@ fi # Only puppet 3.2.1 - 3.8 support "--parser future" option. case $(puppet --version) in - 4*) USE_PUPPET_FUTURE_PARSER="disabled" ;; + 4*|5*) USE_PUPPET_FUTURE_PARSER="disabled" ;; esac while read -r oldrev newrev refname; do From 147dd057cf0c1853eb119ca02d40791b64eea7ae Mon Sep 17 00:00:00 2001 From: Clemens Bergmann Date: Fri, 14 Sep 2018 08:57:52 +0200 Subject: [PATCH 3/3] not using RC --- commit_hooks/r10k_syntax_check.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commit_hooks/r10k_syntax_check.sh b/commit_hooks/r10k_syntax_check.sh index 1dd22ed..ebaa250 100755 --- a/commit_hooks/r10k_syntax_check.sh +++ b/commit_hooks/r10k_syntax_check.sh @@ -5,9 +5,10 @@ echo "Performing a syntax check on the r10k Puppetfile:" pushd "$1" >/dev/null r10k puppetfile check +RC=$? popd >/dev/null -if [[ $? -ne 0 ]] +if [[ $RC -ne 0 ]] then exit 1 fi