@@ -9,8 +9,6 @@ metadata:
9
9
data :
10
10
copy-certs.sh : |
11
11
#!/bin/bash
12
- MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/ml-secrets/username)"
13
- MARKLOGIC_ADMIN_PASSWORD="$(< /run/secrets/ml-secrets/username)"
14
12
log () {
15
13
local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
16
14
echo "${TIMESTAMP} $@"
@@ -176,6 +174,22 @@ data:
176
174
echo $message >> /tmp/script.log
177
175
}
178
176
177
+ retry() {
178
+ local retries=$1
179
+ shift
180
+ local count=0
181
+ until "$@"; do
182
+ exit_code=$?
183
+ count=$((count + 1))
184
+ if [ $count -ge $retries ]; then
185
+ echo "Command failed after $retries attempts."
186
+ return $exit_code
187
+ fi
188
+ echo "Attempt $count failed. Retrying..."
189
+ sleep 5
190
+ done
191
+ }
192
+
179
193
###############################################################
180
194
# Function to get the current host protocol
181
195
# $1: The host name
@@ -559,9 +573,11 @@ data:
559
573
info "group \"${current_group}\" updated and a restart of all hosts in the group was triggered"
560
574
else
561
575
info "unexpected response when updating group \"${current_group}\": ${response_code}"
576
+ return 1
562
577
fi
563
578
else
564
579
info "failed to get current group, response code: ${response_code}"
580
+ return 1
565
581
fi
566
582
567
583
if [[ "$MARKLOGIC_CLUSTER_TYPE" == "non-bootstrap" ]]; then
@@ -584,7 +600,7 @@ data:
584
600
else
585
601
info "not bootstrap host. Skip group configuration"
586
602
fi
587
-
603
+ return 0
588
604
}
589
605
590
606
function configure_tls {
@@ -813,10 +829,10 @@ data:
813
829
if [[ "${MARKLOGIC_CLUSTER_TYPE}" == "bootstrap" ]]; then
814
830
log "Info: bootstrap host is ready"
815
831
init_security_db
816
- configure_group
832
+ retry 5 configure_group
817
833
else
818
834
log "Info: bootstrap host is ready"
819
- configure_group
835
+ retry 5 configure_group
820
836
join_cluster $HOST_FQDN
821
837
fi
822
838
configure_path_based_routing
0 commit comments