Created
March 7, 2015 16:18
-
-
Save evgeny-goldin/7162a24713c3ac23bcf7 to your computer and use it in GitHub Desktop.
Validate project's JSON and YAMl files
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
# Validate project's JSON files | |
function vj() | |
{ | |
if [ "$1" == "" ]; then | |
local path="." | |
else | |
local path="$1" | |
fi | |
for json in $(find "$path" -name "*.json"); do | |
echo "$json" | |
python -m json.tool "$json" > /dev/null | |
if [ "$?" != "0" ]; then | |
echo "===> [$json] check has failed!" | |
fi | |
done | |
} | |
# Validate project's YAML files | |
function vy() | |
{ | |
if [ "$1" == "" ]; then | |
local path="." | |
else | |
local path="$1" | |
fi | |
for yml in $(find "$path" -name "*.yml"); do | |
echo "$yml" | |
# pip install --upgrade pyyaml | |
python -c "import yaml; yaml.load( open('$yml','r'))" | |
if [ "$?" != "0" ]; then | |
echo "===> [$yml] check has failed!" | |
fi | |
done | |
} | |
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
$ vj | |
./packer/ansible/packer-template.json | |
./packer/packer/packer-template.json | |
./packer/packer-iam.json | |
$ vy | |
./playbooks/artifactory-ubuntu.yml | |
./playbooks/asgard-ubuntu.yml | |
./playbooks/docker-ubuntu.yml | |
./playbooks/helios-agent-ubuntu.yml | |
./playbooks/helios-cli-ubuntu.yml | |
./playbooks/helios-master-ubuntu.yml | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment