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 if [ -d $HOME/joid_config/deployconfig.yaml ]; then
11 cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true
13 python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml
17 if [ ! -d environments.yaml ]; then
18 cp ~/joid_config/environments.yaml ./environments.yaml || true
19 cp ~/.juju/environments.yaml ./environments.yaml || true
24 if [[ "$jujuver" > "2" ]]; then
25 controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
26 cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
27 juju destroy-controller $controllername --destroy-all-models -y || true
28 juju kill-controller $controllername --timeout 10s -y || true
32 rm -rf ~/joid_config/admin-openrc
34 sudo sysctl -w vm.drop_caches=3
35 elif [ -d $HOME/.juju/environments ]; then
37 juju status &>>status.txt || true
38 if [ "$(grep -c "environment is not bootstrapped" status.txt )" -ge 1 ]; then
39 echo " environment is not bootstrapped ..."
41 echo " environment is bootstrapped ..."
42 jujuenv=`juju status | grep environment | cut -d ":" -f 2`
43 juju destroy-environment $jujuenv -y || true
49 rm -rf $HOME/.juju/.deployer-store-cache
50 rm -rf $HOME/.juju/environments
51 rm -rf $HOME/.juju/ssh
52 sudo sysctl -w vm.drop_caches=3