Skip to content

Commit ec124a4

Browse files
committed
Customizable configuration template
1 parent 4a4eff7 commit ec124a4

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

CHANGES.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file.
33
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
44
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
55

6-
[0.1.1] - 2021-11-24
6+
[0.1.2] - 2021-11-24
77
====================
88

99
Added
@@ -12,6 +12,14 @@ Added
1212
- Added `ldapsearch` command. :pr:`4`
1313
- The root DN can add schemas. :pr:`5`
1414

15+
[0.1.1] - 2021-05-06
16+
====================
17+
18+
Added
19+
*****
20+
21+
- Customizable configuration template
22+
1523
[0.1.0] - 2021-04-02
1624
====================
1725

slapd/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ class Slapd:
126126
127127
:param root_pw: The root user password. The default value is `password`.
128128
129+
:param configuration_template: An optional inital database template.
130+
129131
:param datadir_prefix: The prefix of the temporary directory where the slapd
130132
configuration and data will be stored. The default value is `python-ldap-test`.
131133
@@ -157,6 +159,7 @@ def __init__(
157159
suffix="dc=slapd-test,dc=python-ldap,dc=org",
158160
root_cn="Manager",
159161
root_pw="password",
162+
configuration_template=None,
160163
datadir_prefix=None,
161164
debug=None,
162165
):
@@ -178,6 +181,7 @@ def __init__(
178181
self._slapd_conf = os.path.join(self.testrundir, "slapd.d")
179182
self._db_directory = os.path.join(self.testrundir, "openldap-data")
180183
self.ldap_uri = "ldap://%s:%d/" % (self.host, self.port)
184+
self.configuration_template = configuration_template or SLAPD_CONF_TEMPLATE
181185
self.debug = debug
182186
have_ldapi = hasattr(socket, "AF_UNIX")
183187
if have_ldapi:
@@ -307,7 +311,7 @@ def _gen_config(self):
307311
"servercert": self.servercert,
308312
"serverkey": self.serverkey,
309313
}
310-
return SLAPD_CONF_TEMPLATE % config_dict
314+
return self.configuration_template % config_dict
311315

312316
def _write_config(self):
313317
"""Loads the slapd.d configuration."""

0 commit comments

Comments
 (0)