Skip to content

Bootstrap script breaks due to non-set environment variables #49

Closed
@IngmarPaetzold

Description

@IngmarPaetzold

After building the container locally, I had the same issue as #42 and could solve that with https://github.com/jskacel 's proposal:
https://github.com/rroemhild/docker-test-openldap/blob/master/rootfs/opt/openldap/bootstrap/config/tls.ldif#L3-L5

However, the script broke again:

Load data...
++ find /opt/openldap/bootstrap/data -maxdepth 1 -name '*_*.ldif' -type f
++ sort
Processing file /opt/openldap/bootstrap/data/00_people.ldif...
[...]
/opt/openldap/bootstrap/data/30_groups_crew.ldif'
+ for ldif in ${data}
+ echo 'Processing file /opt/openldap/bootstrap/data/00_people.ldif...'
/var/run/s6/etc/cont-init.d/050-openldap-populate: line 43: LDAP_BASEDN: unbound variable
[cont-init.d] 050-openldap-populate: exited 1.
[cont-init.d] done.
[services.d] starting services
starting slapd
[services.d] done.
65002ed6 @(#) $OpenLDAP: slapd  (May 14 2022 18:35:44) $
        Debian OpenLDAP Maintainers <[email protected]>
65002ed6 hdb_db_open: database "dc=planetexpress,dc=com": database already in use.
65002ed6 backend_startup_one (type=hdb, suffix="dc=planetexpress,dc=com"): bi_db_open failed! (-1)
65002ed6 slapd stopped.

It fails because variables LDAP_BASEDN and LDAP_DOMAIN are not set, but script /rootfs/etc/cont-init.d/050-openldap-populate references them.
Reason is the set -eux on top which makes every non-set variable an error.

Therefore the script breaks and does not stop the database, which, as consequence, raises the database already in use error.

I will file a pull request for that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions