Merge "cleanup old controllers and models for virtual deployments"
[joid.git] / ci / deploy.sh
index 1ffa7da..94c7b41 100755 (executable)
@@ -2,7 +2,7 @@
 
 set -ex
 
-#need to put mutiple cases here where decide this bundle to deploy by default use the odl bundle.
+#need to put multiple cases here where decide this bundle to deploy by default use the odl bundle.
 # Below parameters are the default and we can according the release
 
 opnfvsdn=nosdn
@@ -141,8 +141,8 @@ deploy() {
                 echo " MAAS not deployed please deploy MAAS first."
             fi
         fi
-#create json file which is missing in case of new deployment after maas and git tree cloned freshly.
 
+        #create json file which is missing in case of new deployment after maas and git tree cloned freshly.
         python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < labconfig.yaml > labconfig.json
         python -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4)' < deployconfig.yaml > deployconfig.json
 
@@ -180,17 +180,19 @@ deploy() {
 
 #check whether charms are still executing the code even juju-deployer says installed.
 check_status() {
+    waitstatus=$1
     retval=0
     timeoutiter=0
 
-    echo -n "executing the reltionship within charms ."
+    echo -n "executing the relationship within charms ."
     while [ $retval -eq 0 ]; do
-       sleep 30
-       if juju status | grep -q "executing"; then
+        if juju status | grep -q $waitstatus; then
            echo -n '.'
            if [ $timeoutiter -ge 120 ]; then
                echo 'timed out'
                retval=1
+           else
+               sleep 30
            fi
            timeoutiter=$((timeoutiter+1))
        else
@@ -203,8 +205,9 @@ check_status() {
         juju expose ceph-radosgw || true
         #juju ssh ceph/0 \ 'sudo radosgw-admin user create --uid="ubuntu" --display-name="Ubuntu Ceph"'
     fi
+
     echo "...... deployment finishing ......."
-}
+ }
 
 # In the case of a virtual deployment
 if [ "$virtinstall" -eq 1 ]; then
@@ -214,7 +217,7 @@ fi
 echo "...... deployment started ......"
 deploy
 
-check_status
+check_status executing
 
 echo "...... deployment finished  ......."
 
@@ -252,7 +255,7 @@ echo "...... configure  ......."
 if ([ $opnfvmodel == "openstack" ]); then
     ./openstack.sh "$opnfvsdn" "$opnfvlab" "$opnfvdistro" "$openstack" || true
 
-    # creating heat domain after puching the public API into /etc/hosts
+    # creating heat domain after pushing the public API into /etc/hosts
     if [[ "$jujuver" > "2" ]]; then
         status=`juju run-action heat/0 domain-setup`
         echo $status
@@ -264,6 +267,10 @@ if ([ $opnfvmodel == "openstack" ]); then
     sudo ../juju/get-cloud-images || true
     ../juju/joid-configure-openstack || true
 
+    if grep -q 'openbaton' bundles.yaml; then
+        juju add-relation openbaton keystone
+    fi
+
 elif ([ $opnfvmodel == "kubernetes" ]); then
     ./k8.sh
 fi