moving inventory file parsing to python
[apex.git] / ci / deploy.sh
index 91663df..0044197 100755 (executable)
@@ -179,8 +179,19 @@ parse_cmdline() {
     exit 1
   fi
 
-  if [[ -n "$virtual" && -n "$INVENTORY_FILE" ]]; then
-    echo -e "${red}ERROR: You should not specify an inventory with virtual deployments${reset}"
+  # inventory file usage validation
+  if [[ -n "$virtual" ]]; then
+      if [[ -n "$INVENTORY_FILE" ]]; then
+          echo -e "${red}ERROR: You should not specify an inventory file with virtual deployments${reset}"
+          exit 1
+      else
+          INVENTORY_FILE='/tmp/inventory-virt.yaml'
+      fi
+  elif [[ -z "$INVENTORY_FILE" ]]; then
+    echo -e "${red}ERROR: You must specify an inventory file for baremetal deployments! Exiting...${reset}"
+    exit 1
+  elif [[ ! -f "$INVENTORY_FILE" ]]; then
+    echo -e "{$red}ERROR: Inventory File: ${INVENTORY_FILE} does not exist! Exiting...${reset}"
     exit 1
   fi
 
@@ -194,16 +205,6 @@ parse_cmdline() {
     exit 1
   fi
 
-  if [[ ! -z "$INVENTORY_FILE" && ! -f "$INVENTORY_FILE" ]]; then
-    echo -e "{$red}ERROR: Inventory File: ${INVENTORY_FILE} does not exist! Exiting...${reset}"
-    exit 1
-  fi
-
-  if [[ -z "$virtual" && -z "$INVENTORY_FILE" ]]; then
-    echo -e "${red}ERROR: You must specify an inventory file for baremetal deployments! Exiting...${reset}"
-    exit 1
-  fi
-
   if [[ "$net_isolation_enabled" == "FALSE" && "$post_config" == "TRUE" ]]; then
     echo -e "${blue}INFO: Post Install Configuration will be skipped.  It is not supported with --flat${reset}"
     post_config="FALSE"
@@ -226,9 +227,8 @@ main() {
   setup_undercloud_vm
   if [ "$virtual" == "TRUE" ]; then
     setup_virtual_baremetal $VM_CPUS $VM_RAM
-  elif [ -n "$INVENTORY_FILE" ]; then
-    parse_inventory_file
   fi
+  parse_inventory_file
   configure_undercloud
   overcloud_deploy
   if [ "$post_config" == "TRUE" ]; then