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