#!/usr/bin/env bash
-#set -x
+set -eu -o pipefail
# shellcheck disable=SC1091
source lib/common.sh
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
}
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