File tree 4 files changed +6
-12
lines changed
4 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -5,5 +5,6 @@ gem 'rspec-puppet'
5
5
gem 'json_pure'
6
6
gem 'psych'
7
7
gem 'metadata-json-lint'
8
+ gem 'yaml-lint'
8
9
gem 'puppet' , '3.8.6'
9
10
gem 'puppet-lint' , '2.0.0'
Original file line number Diff line number Diff line change 4
4
# to a puppet manifest file for which it will run syntax checks against.
5
5
6
6
manifest_path=" $1 "
7
- module_dir=" $2 "
8
- USE_PUPPET_FUTURE_PARSER=" $3 "
7
+ USE_PUPPET_FUTURE_PARSER=" $2 "
9
8
10
9
syntax_errors=0
11
10
error_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"
20
13
21
14
# Get list of new/modified manifest and template files to check (in git index)
22
15
# Check puppet manifest syntax
Original file line number Diff line number Diff line change 14
14
15
15
# Check YAML file syntax
16
16
$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 "
18
18
if [ $? -ne 0 ]; then
19
19
sed -e " s/^/$( tput setaf 1) /" -e " s/$/$( tput sgr0) /" " $error_msg "
20
20
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
82
82
failures=$(( failures + 1 ))
83
83
fi
84
84
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 "
86
86
RC=$?
87
87
if [[ " $RC " -ne 0 ]]; then
88
88
failures=$(( failures + 1 ))
You can’t perform that action at this time.
0 commit comments