Merge "Change the deployment mode from 'nonha' to 'noha'"
[joid.git] / ci / deploy.sh
index 8491ad4..15229e6 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
@@ -14,6 +14,7 @@ opnfvfeature=none
 opnfvdistro=xenial
 opnfvarch=amd64
 opnfvmodel=openstack
+virtinstall=0
 
 jujuver=`juju --version`
 
@@ -33,9 +34,10 @@ usage() { echo "Usage: $0 [-s <nosdn|odl|opencontrail>]
                          [-d <trusty|xenial>]
                          [-a <amd64>]
                          [-m <openstack|kubernetes>]
+                         [-i <0|1>]
                          [-r <a|b>]" 1>&2 exit 1; }
 
-while getopts ":s:t:o:l:h:r:f:d:a:m:" opt; do
+while getopts ":s:t:o:l:h:r:f:d:a:m:i:" opt; do
     case "${opt}" in
         s)
             opnfvsdn=${OPTARG}
@@ -64,6 +66,9 @@ while getopts ":s:t:o:l:h:r:f:d:a:m:" opt; do
         m)
             opnfvmodel=${OPTARG}
             ;;
+        i)
+            virtinstall=${OPTARG}
+            ;;
         h)
             usage
             ;;
@@ -136,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
 
@@ -179,7 +184,7 @@ check_status() {
     retval=0
     timeoutiter=0
 
-    echo -n "executing the reltionship within charms ."
+    echo -n "executing the relationship within charms ."
     while [ $retval -eq 0 ]; do
         if juju status | grep -q $waitstatus; then
            echo -n '.'
@@ -204,6 +209,11 @@ check_status() {
     echo "...... deployment finishing ......."
  }
 
+# In the case of a virtual deployment
+if [ "$virtinstall" -eq 1 ]; then
+    ./clean.sh || true
+fi
+
 echo "...... deployment started ......"
 deploy
 
@@ -245,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