X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=deploy%2Fmetal3%2Fscripts%2F03_verify_deprovisioning.sh;h=7ffcc0139dfeea16f26b9227bdb3f4df1867cb45;hb=30b77af0fb5fc89e7b9e76f4e6e33aaf82832945;hp=afe0497c6f37e5e6691622158e615be839671340;hpb=802e1f9ef59d38f337ca291df6bf1fb140ef7404;p=icn.git diff --git a/deploy/metal3/scripts/03_verify_deprovisioning.sh b/deploy/metal3/scripts/03_verify_deprovisioning.sh index afe0497..7ffcc01 100755 --- a/deploy/metal3/scripts/03_verify_deprovisioning.sh +++ b/deploy/metal3/scripts/03_verify_deprovisioning.sh @@ -14,12 +14,17 @@ function check_deprovisioned { declare -i prev_host_state=0 declare -i j=0 echo "Baremetal state: 1 means deprovisioned & 0 means not yet deprovisioned" - 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') + if kubectl get baremetalhost $name -n metal3 &>/dev/null; then + state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state') + else + # When the named BareMetalHost is not found, assume its deprovisioned + state="ready" + fi echo "Baremetal host metal3 state - "$name" : "$state - if [ $state == "ready" ];then + if [ "$state" == "ready" ];then current_host_state=1 fi