Add YAML sytax check

Change-Id: Ida7aa1dc6410f91a87af805467051f9b3e64d1fc
This commit is contained in:
Dmitry Ilyin 2015-11-26 17:16:25 +03:00
parent 39dcd26bc3
commit 345ec873fb

View File

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
usage="$(basename "$0") [-h] [-m MODULE] [-a] -- runs syntax check for puppet modules, by default runs tests only for changed modules. usage="$(basename "$0") [-h] [-m MODULE] [-a] -- runs syntax check for puppet modules, by default runs tests only for changed modules.
where: where:
@ -88,7 +87,7 @@ function check_lint {
# Function that checks syntax # Function that checks syntax
function check_syntax { function check_syntax {
exit_code=0 exit_code=0
all_files=`find . -name "*.pp" -o -name "*.erb" -o -name "*.sh" -o -path "*/files/ocf/*"` all_files=`find . -name "*.pp" -o -name "*.erb" -o -name "*.sh" -o -name '*.yaml' -o -name '*.yml' -o -path "*/files/ocf/*"`
for x in $all_files; do for x in $all_files; do
case $x in case $x in
*.pp ) *.pp )
@ -100,6 +99,12 @@ function check_syntax {
*.sh ) *.sh )
bash -n $x bash -n $x
;; ;;
*.yaml | *.yml )
ruby -ryaml -e "
puts 'Checking YAML file: ${x}'
YAML.load_file('${x}')
exit(0)"
;;
*files/ocf/* ) *files/ocf/* )
case $(file --mime --brief $x) in case $(file --mime --brief $x) in
*x-shellscript*) *x-shellscript*)