5 if [ ! -d environments.yaml ]; then
6 cp ~/joid_config/environments.yaml ./environments.yaml || true
7 cp ~/.juju/environments.yaml ./environments.yaml || true
10 if [ ! -d deployment.yaml ]; then
11 cp ~/joid_config/deployment.yaml ./deployment.yaml || true
12 cp ~/.juju/deployment.yaml ./deployment.yaml || true
15 jujuver=`juju --version`
17 if [[ "$jujuver" > "2" ]]; then
18 controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml`
19 cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml`
20 juju kill-controller $controllername --timeout 10s -y || true
25 sudo sysctl -w vm.drop_caches=3
26 elif [ -d $HOME/.juju/environments ]; then
28 juju status &>>status.txt || true
29 if [ "$(grep -c "environment is not bootstrapped" status.txt )" -ge 1 ]; then
30 echo " environment is not bootstrapped ..."
32 echo " environment is bootstrapped ..."
33 jujuenv=`juju status | grep environment | cut -d ":" -f 2`
34 juju destroy-environment $jujuenv -y || true
40 rm -rf $HOME/.juju/.deployer-store-cache
41 rm -rf $HOME/.juju/environments
42 rm -rf $HOME/.juju/ssh
43 sudo sysctl -w vm.drop_caches=3
46 #sudo apt-get purge maas maas-cli maas-common maas-dhcp maas-dns maas-proxy maas-rack-controller maas-region-api maas-region-controller -y
47 #sudo rm -rf /var/lib/maas