set -ex
-if [ ! -d environments.yaml ]; then
- cp ~/joid_config/environments.yaml ./environments.yaml
-fi
-
-jujuver=`juju --version`
-
-if [ "$jujuver" -ge "2" ]; then
- controllername=`awk 'NR==1{print $2}' environments.yaml`
- cloudname=`awk 'NR==1{print $2}' environments.yaml`
- juju kill-controller $controllername --timeout 10s -y || true
- rm -rf precise
- rm -rf trusty
- rm -rf xenial
-elif [ -d $HOME/.juju/environments ]; then
- echo " " > status.txt
- juju status &>>status.txt || true
- if [ "$(grep -c "environment is not bootstrapped" status.txt )" -ge 1 ]; then
- echo " environment is not bootstrapped ..."
+if [ ! -d labconfig.yaml ]; then
+ cp ~/joid_config/labconfig.yaml ./labconfig.yaml || true
+ if [ -d $HOME/joid_config/deployconfig.yaml ]; then
+ cp ~/joid_config/deployconfig.yaml ./deployconfig.yaml || true
else
- echo " environment is bootstrapped ..."
- jujuenv=`juju status | grep environment | cut -d ":" -f 2`
- juju destroy-environment $jujuenv -y || true
+ python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml
fi
- rm -rf precise
- rm -rf trusty
- rm -rf xenial
- rm -rf $HOME/.juju/j*
- rm -rf $HOME/.juju/.deployer-store-cache
- rm -rf $HOME/.juju/environments
- rm -rf $HOME/.juju/ssh
fi
+controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
+cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployconfig.yaml`
+juju destroy-controller $controllername --destroy-all-models -y || true
+#juju kill-controller $controllername --timeout 10s -y || true
+rm -rf precise
+rm -rf trusty
+rm -rf xenial
+rm -rf bionic
+rm -rf ~/joid_config/admin-openrc
+sleep 10
+sudo sysctl -w vm.drop_caches=3