compass-core/bin/chef/clean_environments.sh
xiaodongwang 37a334a7b7 clean cobbler and chef when refresh
Change-Id: I15d24c3e8b08956710de4c86083def4dd55cf0cf
2014-09-08 11:55:50 -07:00

14 lines
371 B
Bash
Executable File

#!/bin/bash
echo "clean chef environments"
environments=$(knife environment list)
for environment in $environments; do
if [[ "$environment" != "_default" ]]; then
yes | knife environment delete $environment
if [[ "$?" != "0" ]]; then
echo "failed to delete environment $environment"
else
echo "environment $environment is deleted"
fi
fi
done