X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=deploy%2Fmetal3%2Fscripts%2F03_verify_deprovisioning.sh;h=5c49d1d5abb0ff8772884eb9bef72b521720e1fc;hb=ec258715d6f8d779d79555a7c75ba28d4fef9170;hp=4223cd8f12d5be8cb8557b8a331e2b13f74e10ef;hpb=deb3ca8295b2e585e47e51730252dc2ec1daa429;p=icn.git diff --git a/deploy/metal3/scripts/03_verify_deprovisioning.sh b/deploy/metal3/scripts/03_verify_deprovisioning.sh index 4223cd8..5c49d1d 100755 --- a/deploy/metal3/scripts/03_verify_deprovisioning.sh +++ b/deploy/metal3/scripts/03_verify_deprovisioning.sh @@ -16,10 +16,15 @@ function check_deprovisioned { echo "Baremetal state: 1 means deprovisioned & 0 means not yet deprovisioned" while IFS=',' read -r name ipmi_username ipmi_password ipmi_address 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