mirror of
https://github.com/bitnami/containers.git
synced 2026-10-19 11:08:09 +02:00
[bitnami/openldap] Fix timing issue where openldap is not yet ready (#22112)
* Fix timing issue where openldap is not yet ready Signed-off-by: tatankat <tatankat@users.noreply.github.com> * Rename is_ldap_answering to is_ldap_ready and doc cleanup Signed-off-by: tatankat <tatankat@users.noreply.github.com> * Skip SC2015 as this works as intended Signed-off-by: tatankat <tatankat@users.noreply.github.com> --------- Signed-off-by: tatankat <tatankat@users.noreply.github.com>
This commit is contained in:
@@ -150,6 +150,18 @@ ldap_validate() {
|
||||
[[ "$error_code" -eq 0 ]] || exit "$error_code"
|
||||
}
|
||||
|
||||
########################
|
||||
# Check if OpenLDAP is ready to answer
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# Whether slapd is ready to answer
|
||||
#########################
|
||||
is_ldap_ready() {
|
||||
# shellcheck disable=SC2015
|
||||
is_ldap_running && debug_execute ldapsearch -Y EXTERNAL -H "ldapi:///" -b cn=config -s base || false
|
||||
}
|
||||
|
||||
########################
|
||||
# Check if OpenLDAP is running
|
||||
# Globals:
|
||||
@@ -197,7 +209,7 @@ ldap_start_bg() {
|
||||
ulimit -n "$LDAP_ULIMIT_NOFILES"
|
||||
am_i_root && flags=("-u" "$LDAP_DAEMON_USER" "${flags[@]}")
|
||||
debug_execute slapd "${flags[@]}" &
|
||||
if ! retry_while is_ldap_running "$retries" "$sleep_time"; then
|
||||
if ! retry_while is_ldap_ready "$retries" "$sleep_time"; then
|
||||
error "OpenLDAP failed to start"
|
||||
return 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user