Do not stop loop on error 17/3617/1
authorYolanda Robla <yroblamo@redhat.com>
Fri, 10 Jul 2020 09:55:11 +0000 (11:55 +0200)
committerYolanda Robla <yroblamo@redhat.com>
Fri, 10 Jul 2020 09:55:11 +0000 (11:55 +0200)
It can be the case that the oc get nodes api is returning EOF,
which is causing an error and is breaking the loop befor time.
Change the way we capture the nodes, by allowing failure, then
compute the ready nodes.

Signed-off-by: Yolanda Robla <yroblamo@redhat.com>
Change-Id: I176682c2206075c221ab8d3e634a11cfc4c539d0

ci/kni_deploy_baremetal.sh

index fbdd8d3..71b482f 100755 (executable)
@@ -41,7 +41,8 @@ sleep 20m
 
 NUM_READY=0
 while [[ "$NUM_READY" -lt 1 ]]; do
-    NUM_READY=$(KUBECONFIG=$HOME/.kni/$SITE_NAME/baremetal_automation/ocp/auth/kubeconfig $HOME/.kni/$SITE_NAME/requirements/oc get nodes | grep " Ready " | wc -l )
+    READY_NODES=$(KUBECONFIG=$HOME/.kni/$SITE_NAME/baremetal_automation/ocp/auth/kubeconfig $HOME/.kni/$SITE_NAME/requirements/oc get nodes)
+    NUM_READY=$(echo $READY_NODES | grep " Ready " | wc -l )
     sleep 1m
 done
 popd