Skip to content

Commit 0b1867d

Browse files
committed
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.
1 parent 4f77b17 commit 0b1867d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

data/data/bootstrap/baremetal/files/usr/local/bin/master-bmh-update.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ until oc get baremetalhosts -n openshift-machine-api; do
1010
sleep 20
1111
done
1212

13-
while [ "$(oc get bmh -n openshift-machine-api -o name | wc -l)" -lt 1 ]; do
14-
echo "Waiting for bmh"
13+
N="0"
14+
while [ "$N" -eq "0" ] ; do
15+
echo "Waiting for control-plane bmh to appear..."
1516
sleep 20
17+
N=$(oc get bmh -n openshift-machine-api -l installer.openshift.io/role=control-plane --no-headers=true | wc -l)
1618
done
17-
18-
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
19-
echo "Waiting for masters to become provisioned"
20-
oc get bmh -A
19+
echo "Waiting for $N masters to become provisioned"
20+
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)" -lt "$N" ]; do
21+
echo "Waiting for $N masters to become provisioned"
22+
oc get bmh -A || true
2123
sleep 20
2224
done
2325

0 commit comments

Comments
 (0)