Run syntax check for OCF scripts

Make fuel_syntax_check.sh script run syntax check for any file
found under "files/ocf/" subfolder in all puppet modules.

Also bugfix for "rake spec" testing part of the script.

Change-Id: I83c5bb1366b9284ff411c3e3e54e3a27c4049815
Closes-bug: 1376254
Closes-bug: 1378857
DocImpact
This commit is contained in:
Aleksandr Didenko 2014-10-08 11:55:47 +03:00
parent e46e4325ea
commit b9176b28ed

View File

@ -13,7 +13,7 @@ set -e
if [ -z "$*" ]; then
ruby_files=`find -type f -print0 | xargs -0 file -i | grep -i ruby | awk -F: '{ print $1 }'`
all_files="${ruby_files} `find -name "*.pp" -o -name "*.erb" -o -name "*.sh"`"
all_files="${ruby_files} `find -name "*.pp" -o -name "*.erb" -o -name "*.sh" -o -path "*/files/ocf/*"`"
else
all_files="$*"
fi
@ -50,11 +50,28 @@ for x in $all_files; do
*.sh )
bash -n $x
;;
*files/ocf/* )
case $(file --mime --brief $x) in
*x-shellscript*)
bash -n $x
;;
*x-ruby*)
ruby -c $x
;;
*x-python*)
python -m py_compile $x
;;
*x-perl*)
perl -c $x
;;
esac
;;
esac
done
if [ "$1" = "-u" ];
then
fail=0
all_files=`find -iname "rakefile"`
num_files=`echo $all_files | wc -w`
if test $num_files -eq "0" ; then