X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2Fclean.sh;h=feecd70a83e349a3273bb28d522b639a0a71be12;hb=3c848787b3c8f2bdbf7723a5178b688e018f1e95;hp=eaff136bd052041d9aaadeaab97a88f38b2a6415;hpb=1e29dbbb3bfb71fa4c79a67dcd07b9cddca63ac2;p=joid.git diff --git a/ci/clean.sh b/ci/clean.sh index eaff136b..feecd70a 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -2,20 +2,35 @@ set -ex -if [ ! -d environments.yaml ]; then - cp ~/joid_config/environments.yaml ./environments.yaml || true - cp ~/.juju/environments.yaml ./environments.yaml || true +jujuver=`juju --version` + +if [[ "$jujuver" > "2" ]]; then + 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 + python genDeploymentConfig.py -l labconfig.yaml > deployconfig.yaml + fi + fi +else + if [ ! -d environments.yaml ]; then + cp ~/joid_config/environments.yaml ./environments.yaml || true + cp ~/.juju/environments.yaml ./environments.yaml || true + fi 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` + 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 ~/joid_config/admin-openrc + sleep 30 sudo sysctl -w vm.drop_caches=3 elif [ -d $HOME/.juju/environments ]; then echo " " > status.txt @@ -36,6 +51,3 @@ elif [ -d $HOME/.juju/environments ]; then 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