Skip to content

Commit

Permalink
In SlapdObject, build include directives dynamically
Browse files Browse the repository at this point in the history
Allows overriding openldap_schema_files without requiring rewriting the
conf file.

https://github.com/python-ldap/python-ldap/pull/196
  • Loading branch information
Jon Dufresne authored and Petr Viktorin committed Mar 27, 2018
1 parent 06be5eb commit adc40d0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Lib/slapdtest/_slapdtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
SLAPD_CONF_TEMPLATE = r"""
serverID %(serverid)s
moduleload back_%(database)s
include "%(schema_prefix)s/core.schema"
%(include_directives)s
loglevel %(loglevel)s
allow bind_v2
Expand Down Expand Up @@ -316,9 +316,17 @@ def gen_config(self):
for generating specific static configuration files you have to
override this method
"""
include_directives = '\n'.join(
'include "{schema_prefix}/{schema_file}"'.format(
schema_prefix=self._schema_prefix,
schema_file=schema_file,
)
for schema_file in self.openldap_schema_files
)
config_dict = {
'serverid': hex(self.server_id),
'schema_prefix':self._schema_prefix,
'include_directives': include_directives,
'loglevel': self.slapd_loglevel,
'database': self.database,
'directory': self._db_directory,
Expand Down

0 comments on commit adc40d0

Please sign in to comment.