X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2Fclean.sh;h=eaff136bd052041d9aaadeaab97a88f38b2a6415;hb=e63f44eb68b9e87b9b99a135fe75f9f9e84b1103;hp=105ef0cbed84eeb6b314a6e6302dd18541397be5;hpb=7208685b13a35f7f25cb4a7221058f358453cb50;p=joid.git diff --git a/ci/clean.sh b/ci/clean.sh index 105ef0cb..eaff136b 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -2,14 +2,30 @@ set -ex -if [ -d $HOME/.juju/environments ]; then +if [ ! -d environments.yaml ]; then + cp ~/joid_config/environments.yaml ./environments.yaml || true + cp ~/.juju/environments.yaml ./environments.yaml || true +fi + +jujuver=`juju --version` + +if [[ "$jujuver" > "2" ]]; then + controllername=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` + cloudname=`awk 'NR==1{print substr($1, 1, length($1)-1)}' deployment.yaml` + juju kill-controller $controllername --timeout 10s -y || true + rm -rf precise + rm -rf trusty + rm -rf xenial + sudo sysctl -w vm.drop_caches=3 +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 ..." else echo " environment is bootstrapped ..." - juju destroy-environment demo-maas -y + jujuenv=`juju status | grep environment | cut -d ":" -f 2` + juju destroy-environment $jujuenv -y || true fi rm -rf precise rm -rf trusty @@ -18,5 +34,8 @@ if [ -d $HOME/.juju/environments ]; then rm -rf $HOME/.juju/.deployer-store-cache rm -rf $HOME/.juju/environments rm -rf $HOME/.juju/ssh + sudo sysctl -w vm.drop_caches=3 fi +#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 +#sudo rm -rf /var/lib/maas