5 jujuver=`juju --version`
7 if [[ "$jujuver" > "2" ]]; then
8 if [ ! -d labconfig.yaml ]; then
9 cp ~/joid_config/labconfig.yaml ./labconfig.yaml || true
10 cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true
13 if [ ! -d environments.yaml ]; then
14 cp ~/joid_config/environments.yaml ./environments.yaml || true
15 cp ~/.juju/environments.yaml ./environments.yaml || true
20 if [[ "$jujuver" > "2" ]]; then
21 controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
22 cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
23 juju kill-controller $controllername --timeout 10s -y || true
28 sudo sysctl -w vm.drop_caches=3
29 elif [ -d $HOME/.juju/environments ]; then
31 juju status &>>status.txt || true
32 if [ "$(grep -c "environment is not bootstrapped" status.txt )" -ge 1 ]; then
33 echo " environment is not bootstrapped ..."
35 echo " environment is bootstrapped ..."
36 jujuenv=`juju status | grep environment | cut -d ":" -f 2`
37 juju destroy-environment $jujuenv -y || true
43 rm -rf $HOME/.juju/.deployer-store-cache
44 rm -rf $HOME/.juju/environments
45 rm -rf $HOME/.juju/ssh
46 sudo sysctl -w vm.drop_caches=3