X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=ci%2Fclean.sh;h=211bcaa351a40649bdaeda1df6fbada75705d776;hb=b4a7dfec8c638cd5fe754e6da9d3c822262fe9a1;hp=aa2ca44064e0b17b6c226bdd916102ff1888bf16;hpb=a56fce4f323d8a6a232f0205e03c6f601b7eefb5;p=joid.git diff --git a/ci/clean.sh b/ci/clean.sh index aa2ca440..211bcaa3 100755 --- a/ci/clean.sh +++ b/ci/clean.sh @@ -2,7 +2,35 @@ set -ex -if [ -d $HOME/.juju/environments ]; then +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 + + +if [[ "$jujuver" > "2" ]]; then + 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 kill-controller $controllername --timeout 10s -y || true + rm -rf precise + rm -rf trusty + rm -rf xenial + sleep 30 + 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 @@ -10,7 +38,7 @@ if [ -d $HOME/.juju/environments ]; then else echo " environment is bootstrapped ..." jujuenv=`juju status | grep environment | cut -d ":" -f 2` - juju destroy-environment $jujuenv -y + juju destroy-environment $jujuenv -y || true fi rm -rf precise rm -rf trusty @@ -19,5 +47,5 @@ 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 -