diff --git a/commit_hooks/r10k_syntax_check.sh b/commit_hooks/r10k_syntax_check.sh index b820eb9..32e3a13 100755 --- a/commit_hooks/r10k_syntax_check.sh +++ b/commit_hooks/r10k_syntax_check.sh @@ -1,11 +1,17 @@ #!/bin/bash # # This script assumes you have installed r10k and will perform a syntax check on the Puppetfile if existing +old_dir=$PWD +pf_dir=$(dirname $1) echo "Performing a syntax check on the r10k Puppetfile:" -PUPPETFILE="$1" r10k puppetfile check +cd $pf_dir && r10k puppetfile check if [[ $? -ne 0 ]] then - exit 1 + cd $old_dir + exit 1 fi + +cd $old_dir +exit 0