diff --git a/bitnami/openldap/2.6/debian-11/rootfs/opt/bitnami/scripts/libopenldap.sh b/bitnami/openldap/2.6/debian-11/rootfs/opt/bitnami/scripts/libopenldap.sh index 3b2a650ec888..bcc3f6a65e3d 100644 --- a/bitnami/openldap/2.6/debian-11/rootfs/opt/bitnami/scripts/libopenldap.sh +++ b/bitnami/openldap/2.6/debian-11/rootfs/opt/bitnami/scripts/libopenldap.sh @@ -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