#!/usr/bin/env bash
-#set -x
+set -eu -o pipefail
LIBDIR="$(dirname "$(dirname "$(dirname "$PWD")")")"
declare -i prev_host_state=0
declare -i j=0
echo "Baremetal state: 1 means provisioned & 0 means not yet provisioned"
- while read -r name username password address; do
+ while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do
declare -i current_host_state=0
state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state')
echo "Baremetal host metal3 state - "$name" : "$state
- if [ $state == "provisioned" ];then
+ if [ "$state" == "provisioned" ];then
current_host_state=1
fi
}
function wait_for_provisioned {
- all_bmh_provisioned=1
declare -i k=1
while ((timeout > 0)); do
echo "Try $k 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 Baremetal hosts are provisioned - success"
warm_up_time
exit 0