Skip to content

Commit 9f6aedb

Browse files
committed
Make r10k check optional (default enabled)
1 parent d14f943 commit 9f6aedb

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

commit_hooks/config.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CHECK_PUPPET_DOCS="enabled" # enabled, permissive or disabled (permissive runs b
33
USE_PUPPET_FUTURE_PARSER="disabled" # enabled or disabled
44
CHECK_INITIAL_COMMIT="disabled" # enabled or disabled
55
CHECK_RSPEC="enabled" # enabled or disabled
6+
CHECK_R10K="enabled" # enabled or disabled
67
export PUPPET_LINT_OPTIONS="" # puppet-lint options to use if no rc file is present. Defaults to "--no-140chars-check"
78
export PUPPET_LINT_FAIL_ON_WARNINGS="true" # Set the puppet-lint option --fail-on-warnings
89
UNSET_RUBY_ENV="enabled" # enabled or disabled. Required for Gitlab.

pre-commit

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,18 @@ if [[ "$CHECK_RSPEC" != "disabled" ]] ; then
177177
fi
178178

179179
#r10k puppetfile syntax check
180-
if hash r10k >/dev/null 2>&1; then
181-
if [[ "$changedfile" = "Puppetfile" ]]; then
182-
"${subhook_root}/r10k_syntax_check.sh"
183-
RC=$?
184-
if [[ "$RC" -ne 0 ]]; then
185-
failures=$((failures + 1))
186-
fi
180+
if [[ "$CHECK_R10K" != "disabled" ]] ; then
181+
if hash r10k >/dev/null 2>&1; then
182+
if [[ "$changedfile" = "Puppetfile" ]]; then
183+
"${subhook_root}/r10k_syntax_check.sh"
184+
RC=$?
185+
if [[ "$RC" -ne 0 ]]; then
186+
failures=$((failures + 1))
187+
fi
188+
fi
189+
else
190+
echo "r10k not installed. Skipping r10k Puppetfile test..."
187191
fi
188-
else
189-
echo "r10k not installed. Skipping r10k Puppetfile test..."
190192
fi
191193

192194
#summary

pre-receive

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,16 +148,18 @@ while read -r oldrev newrev refname; do
148148
fi
149149
fi
150150
#r10k puppetfile syntax check
151-
if hash r10k >/dev/null 2>&1; then
152-
if [ "$changedfile" = "Puppetfile" ]; then
153-
${subhook_root}/r10k_syntax_check.sh $tmptree/$changedfile
154-
RC=$?
155-
if [ "$RC" -ne 0 ]; then
156-
failures=`expr $failures + 1`
157-
fi
151+
if [[ "$CHECK_R10K" != "disabled" ]] ; then
152+
if hash r10k >/dev/null 2>&1; then
153+
if [[ "$changedfile" = "Puppetfile" ]]; then
154+
"${subhook_root}/r10k_syntax_check.sh" "$tmptree/$changedfile"
155+
RC=$?
156+
if [[ "$RC" -ne 0 ]]; then
157+
failures=$((failures + 1))
158+
fi
159+
fi
160+
else
161+
echo "r10k not installed. Skipping r10k Puppetfile test..."
158162
fi
159-
else
160-
echo "r10k not installed. Skipping r10k Puppetfile test..."
161163
fi
162164
done
163165
done

0 commit comments

Comments
 (0)