Skip to content

Commit fc73b9d

Browse files
committed
Make return values explicit when appropriate (shelldre:S7682) and better report some errors
1 parent 9a58bd6 commit fc73b9d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

entrypoint.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,11 @@ restart() {
140140
if check_proxy; then
141141
log_info "Config is valid so requesting restart..."
142142
$HAPROXY_RESTART_CMD
143-
else
144-
log_info "HAProxy config invalid, not restarting..."
143+
return $?
145144
fi
145+
146+
log_info "HAProxy config invalid, not restarting..."
147+
return 1
146148
}
147149

148150
start_monitor() {
@@ -423,7 +425,7 @@ cert_init() {
423425
sync_haproxy() {
424426
if [ -z "$RENEWED_LINEAGE" ]; then
425427
log_error "sync-haproxy expect RENEWED_LINEAGE variable to be set"
426-
exit 1
428+
return 1
427429
fi
428430

429431
DOMAIN_FOLDER="$RENEWED_LINEAGE"
@@ -433,8 +435,9 @@ sync_haproxy() {
433435

434436
cat "${DOMAIN_FOLDER}/privkey.pem" \
435437
"${DOMAIN_FOLDER}/fullchain.pem" \
436-
> "/tmp/haproxy.pem"
437-
mv "/tmp/haproxy.pem" "${CERT_DIR}/${DOMAIN}"
438+
> "/tmp/haproxy.pem" || return $?
439+
mv "/tmp/haproxy.pem" "${CERT_DIR}/${DOMAIN}"
440+
return $?
438441
}
439442

440443
if [ $# -eq 0 ]

0 commit comments

Comments
 (0)