Skip to content

Unable to start slapdtest on MacOS #422

Open
@dwt

Description

@dwt

Issue description:

Cannot start slapdtest.SlapObject() on MacOS 11.5.1

Steps to reproduce:

import pytest
from pyexpect import expect
import slapdtest

@pytest.fixture(scope='session')
def slapd():
    # homebrew installs openldap as keg-only, thus the path needs to be added
    import subprocess
    import os
    
    # prefix = subprocess.run(['brew', '--prefix'], capture_output=True).stdout.strip().decode()
    # openldap_path = f'{prefix}/opt/openldap'
    # bin_path = f'{openldap_path}/bin'
    # sbin_path = f'{openldap_path}/sbin'
    # libexec_path = f'{openldap_path}/libexec'
    # fixed_path = f'{bin_path}:{sbin_path}:{libexec_path}:' + os.environ['PATH']
    fixed_path = '/usr/libexec/:' + os.environ['PATH']
    slapdtest.SlapdObject.BIN_PATH = fixed_path
    slapdtest.SlapdObject.SBIN_PATH = fixed_path
    
    import logging
    slapdtest.SlapdObject._log.setLevel(logging.DEBUG)
    
    with slapdtest.SlapdObject() as slapd:
        yield slapd
    
def test_smoke(slapd):
    pass

Both the native version provided by apple, as well as the current version from homebrew fail to start - albeit with different reasons.

The Apple provided

% /usr/libexec/slapd -V                                                     :(
@(#) $OpenLDAP: slapd 2.4.28 (Jun 17 2021 16:09:47) $
	root@bb-g9-pdb9.ta10.sd.apple.com:/System/Volumes/Data/SWE/macOS/BuildRoots/d7e177bcf5/Library/Caches/com.apple.xbs/Binaries/OpenLDAP/install/TempContent/Objects/servers/slapd

dies with this error

611d131f /path/to/testdir/slapd.conf: line 12: <database> failed init (mdb)
slaptest: bad configuration file!

That a would be this line database mdb.

The Homebrew version gets slightly further:

~/Library/Homebrew/opt/openldap/libexec/slapd -V                          :(
@(#) $OpenLDAP: slapd 2.5.6 (Aug 18 2021 13:38:48) $
	openldap

this dies with the error

611d1725.219415a8 0x104d79e00 backend_startup_one: starting "cn=config"
611d1725.21951778 0x104d79e00 config_setup_ldif: expected directory /path/to/testdir/python-ldap-test-60577 to be empty!
611d1725.21957d08 0x104d79e00 slapd destroy: freeing system resources.
611d1725.219f7f88 0x104d79e00 slapd stopped.
611d1725.219fe130 0x104d79e00 connections_destroy: nothing to destroy.

I'm not quite sure what to make of this - is there documentation on the supported versions of openldap somewhere? Am I missing a setting I should have applied?

Operating system: Darwin nathan.fritz.box 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64
Python version: Python 3.9.6
python-ldap version: 3.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions