diff --git a/commit_hooks/r10k_syntax_check.sh b/commit_hooks/r10k_syntax_check.sh index b820eb9..ebaa250 100755 --- a/commit_hooks/r10k_syntax_check.sh +++ b/commit_hooks/r10k_syntax_check.sh @@ -3,9 +3,12 @@ # 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 +RC=$? +popd >/dev/null -if [[ $? -ne 0 ]] +if [[ $RC -ne 0 ]] then exit 1 fi diff --git a/pre-commit b/pre-commit index 7a0680c..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 @@ -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..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 @@ -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`