modified to have better logic and by default fallback to amd64.
[joid.git] / ci / deploy.sh
index d61e3ba..bc14630 100755 (executable)
@@ -6,7 +6,7 @@ set -ex
 # Below parameters are the default and we can according the release
 
 opnfvsdn=nosdn
-opnfvtype=nonha
+opnfvtype=noha
 openstack=ocata
 opnfvlab=default
 opnfvrel=e
@@ -14,6 +14,7 @@ opnfvfeature=none
 opnfvdistro=xenial
 opnfvarch=amd64
 opnfvmodel=openstack
+virtinstall=0
 
 jujuver=`juju --version`
 
@@ -26,16 +27,17 @@ read_config() {
 }
 
 usage() { echo "Usage: $0 [-s <nosdn|odl|opencontrail>]
-                         [-t <nonha|ha|tip>]
+                         [-t <noha|ha|tip>]
                          [-o <juno|liberty>]
                          [-l <default|intelpod5>]
                          [-f <ipv6,dpdk,lxd,dvr>]
                          [-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
             ;;
@@ -77,7 +82,7 @@ createresource() {
     # TODO: make sure this function run with the same parameters used in 03-maasdeploy.sh
     PROFILE=${PROFILE:-ubuntu}
     MAAS_IP=$(grep " ip_address" deployconfig.yaml | cut -d ':' -f 2 | sed -e 's/ //')
-    API_SERVER="http://$MAAS_IP/MAAS/api/2.0"
+    API_SERVER="http://$MAAS_IP:5240/MAAS/api/2.0"
     API_KEY=`sudo maas-region apikey --username=ubuntu`
     maas login $PROFILE $API_SERVER $API_KEY
 
@@ -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