From: Narinder Gupta <narinder.gupta@canonical.com>
Date: Fri, 11 Dec 2015 12:54:27 +0000 (-0600)
Subject: fix syntax error and clean the clean.sh
X-Git-Tag: brahmaputra.1.0~110
X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F37%2F4337%2F1;p=joid.git

fix syntax error and clean the clean.sh

Change-Id: Ibb8ff7109aeda126ccb8be522b7e6d2334d54708
---

diff --git a/ci/clean.sh b/ci/clean.sh
index 3e990eae..82fd84e0 100755
--- a/ci/clean.sh
+++ b/ci/clean.sh
@@ -2,10 +2,17 @@
 
 set -ex
 
-#juju-deployer -T -d
-juju destroy-environment demo-maas  -y
-rm -rf ~/.juju/j*
-rm -rf ~/.juju/environments
-rm -rf ~/.juju/ssh
-rm -rf ~/.juju/.deployer-store-cache
+if [ -d "~/.juju/environemnts" ]; then
+    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
+        rm -rf ~/.juju/j*
+        rm -rf ~/.juju/.deployer-store-cache
+    fi
+    rm -rf ~/.juju/environments
+    rm -rf ~/.juju/ssh
+fi
 
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 12806253..ff01eb53 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -84,7 +84,7 @@ check_status() {
        juju status > status.txt 
        if [ "$(grep -c "executing" status.txt )" -ge 1 ]; then
            echo " still executing the reltionship within charms ..."
-           if [ $timeoutiter -ge 60 ] then
+           if [ $timeoutiter -ge 60 ]; then
                retval=1
            fi
            timeoutiter=$((timeoutiter+1))