File tree Expand file tree Collapse file tree 4 files changed +6
-12
lines changed Expand file tree Collapse file tree 4 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ gem 'rspec-puppet'
55gem 'json_pure'
66gem 'psych'
77gem 'metadata-json-lint'
8+ gem 'yaml-lint'
89gem 'puppet' , '3.8.6'
910gem 'puppet-lint' , '2.0.0'
Original file line number Diff line number Diff line change 44# to a puppet manifest file for which it will run syntax checks against.
55
66manifest_path=" $1 "
7- module_dir=" $2 "
8- USE_PUPPET_FUTURE_PARSER=" $3 "
7+ USE_PUPPET_FUTURE_PARSER=" $2 "
98
109syntax_errors=0
1110error_msg=$( mktemp /tmp/error_msg_puppet-syntax.XXXXX)
12-
13- if [[ $module_dir ]]; then
14- manifest_name=" ${manifest_path##* $module_dir } "
15- error_msg_filter=" sed -e s|$module_dir ||"
16- else
17- manifest_name=" $manifest_path "
18- error_msg_filter=" sed"
19- fi
11+ manifest_name=" $manifest_path "
12+ error_msg_filter=" sed"
2013
2114# Get list of new/modified manifest and template files to check (in git index)
2215# Check puppet manifest syntax
Original file line number Diff line number Diff line change 1414
1515# Check YAML file syntax
1616$ERRORS_ONLY || echo -e " $( tput setaf 6) Checking yaml syntax for $module_path ...$( tput sgr0) "
17- ruby -e " require 'yaml'; YAML.parse(File.open(' $1 ')) " 2 > " $error_msg " > /dev/null
17+ yaml-lint $1 > " $error_msg "
1818if [ $? -ne 0 ]; then
1919 sed -e " s/^/$( tput setaf 1) /" -e " s/$/$( tput sgr0) /" " $error_msg "
2020 syntax_errors=$(( syntax_errors + 1 ))
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ for changedfile in $files_to_check; do
8282 failures=$(( failures + 1 ))
8383 fi
8484 elif echo " $changedfile " | grep -iq ' \.pp$' ; then
85- ${subhook_root} /puppet_manifest_syntax_check.sh " $changedfile_native " " " " $USE_PUPPET_FUTURE_PARSER "
85+ ${subhook_root} /puppet_manifest_syntax_check.sh " $changedfile_native " " $USE_PUPPET_FUTURE_PARSER "
8686 RC=$?
8787 if [[ " $RC " -ne 0 ]]; then
8888 failures=$(( failures + 1 ))
You can’t perform that action at this time.
0 commit comments