Skip to content

Instantly share code, notes, and snippets.

@hilotter
Created December 8, 2014 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hilotter/dde3bd703e013f1f8a2e to your computer and use it in GitHub Desktop.
Save hilotter/dde3bd703e013f1f8a2e to your computer and use it in GitHub Desktop.
chefのrolesとnodes以下のjsonをチェックするコマンド(事前に npm install jsonlint -g でjsonlint コマンドをインストールしておく必要あり)
#!/bin/sh
# before install: npm install jsonlint -g
DIR=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd)
CHECK_DIRS=("$DIR/roles/*.json" "$DIR/nodes/*.json")
function check_dirs {
for dir in ${CHECK_DIRS[@]}
do
check_jsons ${dir}
done
}
function check_jsons {
for filepath in $1
do
echo ${filepath}
jsonlint -q ${filepath}
done
}
check_dirs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment