Created
December 8, 2014 14:38
-
-
Save hilotter/dde3bd703e013f1f8a2e to your computer and use it in GitHub Desktop.
chefのrolesとnodes以下のjsonをチェックするコマンド(事前に npm install jsonlint -g でjsonlint コマンドをインストールしておく必要あり)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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