Skip to content

Commit d3bd45e

Browse files
authored
Merge pull request #91 from Klaas-/Klaas--patch-1
Fixes #79 - correctly pass future parser option
2 parents a32fe8c + fab00e2 commit d3bd45e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,17 @@ fi
103103
```
104104

105105
Additionally you can call pre-commit script with two options `-s` and `-a`. First one silence standard informations, which file is currently being checked. Second one allow you to check whole repo, not only files changed locally.
106+
107+
Configuration
108+
===============
109+
You can set configuration options in commit_hooks/config.cfg
110+
This file is sourced by the pre-commit/receive hooks.
111+
112+
Current options:
113+
* CHECK_PUPPET_LINT
114+
* USE_PUPPET_FUTURE_PARSER (only used by Puppet < 4)
115+
* CHECK_INITIAL_COMMIT
116+
* CHECK_RSPEC
117+
* PUPPET_LINT_OPTIONS
118+
* PUPPET_LINT_FAIL_ON_WARNINGS
119+
* UNSET_RUBY_ENV (for GitLab users)

pre-commit

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ if [[ -f "$git_root/.git" ]]; then
4242
fi
4343
fi
4444

45+
# Only puppet 3.2.1 - 3.8 support "--parser future" option.
46+
case $(puppet --version) in
47+
4*) USE_PUPPET_FUTURE_PARSER="disabled" ;;
48+
esac
49+
4550
# Decide if we want puppet-lint
4651
CHECK_PUPPET_LINT="enabled"
4752
if [[ -e ${subhook_root}/config.cfg ]] ; then
@@ -68,7 +73,7 @@ for changedfile in $files_to_check; do
6873
failures=$((failures + 1))
6974
fi
7075
elif [[ $(echo "$changedfile" | grep -q '\.*\.pp$'; echo $?) -eq 0 ]]; then
71-
${subhook_root}/puppet_manifest_syntax_check.sh "$changedfile"
76+
${subhook_root}/puppet_manifest_syntax_check.sh "$changedfile" "" "$USE_PUPPET_FUTURE_PARSER"
7277
RC=$?
7378
if [[ "$RC" -ne 0 ]]; then
7479
failures=$((failures + 1))

0 commit comments

Comments
 (0)