Adding retries for downloading bundle
Due to some reason a nodes can't download bundle file from master
during bootstrap process. The patch adds retries for it.
Related-PROD: PRODX-2361
Change-Id: Ia809006c3121596e08cc5f43e25edb1586e8b3e4
diff --git a/de/heat-templates/scripts/instance_boot.sh b/de/heat-templates/scripts/instance_boot.sh
index 9ec1054..602cb40 100644
--- a/de/heat-templates/scripts/instance_boot.sh
+++ b/de/heat-templates/scripts/instance_boot.sh
@@ -110,12 +110,16 @@
function download_bundles {
local tmpd
tmpd=$(mktemp -d)
+
+ function download_bundles_retry {
+ # Download the client certificate bundle
+ curl -k -H "Authorization: Bearer $AUTHTOKEN" https://${UCP_MASTER_HOST}/api/clientbundle -o ${tmpd}/bundle.zip
+ }
# Download the bundle https://docs.docker.com/ee/ucp/user-access/cli/
# Create an environment variable with the user security token
AUTHTOKEN=$(curl -sk -d '{"username":"'$UCP_USERNAME'","password":"'$UCP_PASSWORD'"}' https://${UCP_MASTER_HOST}/auth/login | jq -r .auth_token)
- # Download the client certificate bundle
- curl -k -H "Authorization: Bearer $AUTHTOKEN" https://${UCP_MASTER_HOST}/api/clientbundle -o ${tmpd}/bundle.zip
+ retry 3 "Can't download bundle file from master." download_bundles_retry
pushd $tmpd
# Unzip the bundle.