Use Vagrantfile to build virtual site
[icn.git] / deploy / metal3-vm / 04_verify.sh
index 0d6e5f2..70fbf22 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env bash
-#set -x
+set -eu -o pipefail
 
 # shellcheck disable=SC1091
 source lib/common.sh
@@ -11,7 +11,7 @@ function check_provisioned {
     declare -i prev_host_state=0
     declare -i j=0
     echo "VM state: 1 means provisioned & 0 means not yet provisioned"
-    while read -r name address user password mac; do
+    while IFS=',' read -r name address user password mac; do
         declare -i current_host_state=0
         state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state')
         echo "VM host metal3 state - "$name" : "$state
@@ -47,15 +47,12 @@ function warm_up_time {
 }
 
 function wait_for_provisioned {
-    all_bmh_provisioned=1
     declare -i k=1
     declare -i t=$timeout
     while ((t > 0)); do
         echo "Try $k/$timeout iteration : Wait for $interval seconds to check all bmh state"
         sleep $interval
-        list_nodes | check_provisioned
-        all_bmh_state=$?
-        if [[ $all_bmh_state -eq $all_bmh_provisioned ]]; then
+        if ! list_nodes | check_provisioned; then
             echo "All the VMs are provisioned - success"
             warm_up_time
             exit 0