summaryrefslogtreecommitdiffstats
path: root/ci/clean.sh
diff options
context:
space:
mode:
authorNarinder Gupta <narinder.gupta@canonical.com>2016-10-16 07:54:56 -0500
committerNarinder Gupta <narinder.gupta@canonical.com>2016-10-16 23:43:55 -0500
commitf1dfc0776d32dea2a2fe7e2cb2b15b1836a6b666 (patch)
treeb75bd8543a4ba5cc7919c43588b2522201c88c90 /ci/clean.sh
parent498d228be6d2bb1f68b5d63813e01ecd68b315cd (diff)
cmodfiied to add juju 2.0 support.
Change-Id: I3981f796cfb9ceb9f32522f4fed831d66e389c48 Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
Diffstat (limited to 'ci/clean.sh')
-rwxr-xr-xci/clean.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/ci/clean.sh b/ci/clean.sh
index db62a11a..4c507b25 100755
--- a/ci/clean.sh
+++ b/ci/clean.sh
@@ -2,7 +2,20 @@
set -ex
-if [ -d $HOME/.juju/environments ]; then
+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
@@ -10,7 +23,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
@@ -20,3 +33,4 @@ if [ -d $HOME/.juju/environments ]; then
rm -rf $HOME/.juju/environments
rm -rf $HOME/.juju/ssh
fi
+