From 933957b339bd9d24e0d15cd399e81118ecf93b41 Mon Sep 17 00:00:00 2001 From: Derek Higgins Date: Thu, 18 Apr 2024 16:04:37 +0100 Subject: [PATCH] Test for the presence of "provisioned" server rather the the absense of lines with "provisioned". If the oc command fails the test will still evaluate to False. Also mask failures from the second "oc get bmh" command so they wont cause the script to exit. --- .../baremetal/files/usr/local/bin/master-bmh-update.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/data/data/bootstrap/baremetal/files/usr/local/bin/master-bmh-update.sh b/data/data/bootstrap/baremetal/files/usr/local/bin/master-bmh-update.sh index 2325e5a67c9..35431a84912 100755 --- a/data/data/bootstrap/baremetal/files/usr/local/bin/master-bmh-update.sh +++ b/data/data/bootstrap/baremetal/files/usr/local/bin/master-bmh-update.sh @@ -15,9 +15,13 @@ while [ "$(oc get bmh -n openshift-machine-api -o name | wc -l)" -lt 1 ]; do sleep 20 done -while [ "$(oc get bmh -n openshift-machine-api -l installer.openshift.io/role=control-plane -o json | jq '.items[].status.provisioning.state' | grep -v provisioned -c)" -gt 0 ]; do +N="0" +while [ "$N" -eq "0" ] ; do + N=$(oc get bmh -n openshift-machine-api -l installer.openshift.io/role=control-plane --no-headers=true | wc -l) +done +while [ "$(oc get bmh -n openshift-machine-api -l installer.openshift.io/role=control-plane -o json | jq '.items[].status.provisioning.state' | grep provisioned -c)" -ne "$N" ]; do echo "Waiting for masters to become provisioned" - oc get bmh -A + oc get bmh -A || true sleep 20 done