Skip to content

Commit

Permalink
re-added SlapdObject._gen_config()
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder committed Apr 26, 2017
1 parent 3fa67ea commit 0711116
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Tests/slapd.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class SlapdObject:
When a reference to an instance of this class is lost, the slapd
server is shut down.
"""

slapd_conf_template = SLAPD_CONF_TEMPLATE
database = 'mdb'
suffix = 'dc=slapd-test,dc=python-ldap,dc=org'
root_cn = 'Manager'
Expand Down Expand Up @@ -113,8 +113,10 @@ def __init__(self):
def __del__(self):
self.stop()

def _write_config(self):
"""Writes the slapd.conf file out, and returns the path to it."""
def _gen_config(self):
"""
generates a slapd.conf and returns it as one string
"""
config_dict = {
'path_schema_core': quote(self.PATH_SCHEMA_CORE),
'loglevel': self.slapd_loglevel,
Expand All @@ -124,9 +126,13 @@ def _write_config(self):
'rootdn': quote(self.root_dn),
'rootpw': quote(self.root_pw),
}
return self.slapd_conf_template % config_dict

def _write_config(self):
"""Writes the slapd.conf file out, and returns the path to it."""
self._log.debug("writing config to %s", self._slapd_conf)
config_file = file(self._slapd_conf, "wb")
config_file.write(SLAPD_CONF_TEMPLATE % config_dict)
config_file.write(self._gen_config())
config_file.close()

def start(self):
Expand Down

0 comments on commit 0711116

Please sign in to comment.