Skip to content

Commit

Permalink
Merge pull request #1480 from Nordix/lentzi90/wait-for-ironic
Browse files Browse the repository at this point in the history
Wait for local ironic to be up
  • Loading branch information
metal3-io-bot authored Dec 11, 2024
2 parents a28e083 + cf1e95c commit 887b5b6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions 03_launch_mgmt_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ EOF
if [[ "${EPHEMERAL_CLUSTER}" != "minikube" ]]; then
update_images
${RUN_LOCAL_IRONIC_SCRIPT}
# Wait for ironic to become ready
echo "Waiting for Ironic to become ready"
retry sudo "${CONTAINER_RUNTIME}" exec ironic /bin/ironic-readiness
else
# Deploy Ironic using deploy.sh script
"${BMOPATH}/tools/deploy.sh" -i "${BMO_IRONIC_ARGS[@]}"
Expand Down
20 changes: 20 additions & 0 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,26 @@ iterate(){
return "${TMP_RET_CODE}"
}

#
# Retry a command until it runs successfully or exceeds the maximum retries
#
# Inputs:
# - the command to run
#
retry()
{
local retries=10
local i
for i in $(seq 1 "${retries}"); do
if "${@}"; then
return 0
fi
echo "Retrying... ${i}/${retries}"
sleep 5
done
return 1
}


#
# Check the return code
Expand Down

0 comments on commit 887b5b6

Please sign in to comment.