diff --git a/CHANGES b/CHANGES index c1a397b..c59e69d 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,8 @@ Changes since 2.4.41: Lib/ * added new SlapdObject methods _ln_schema_files() and _create_sub_dirs() +* SlapdObject methods setup_rundir() and gen_config() + are now "public" methods * removed pseudo test script from module ldap.cidict Tests/ @@ -1473,4 +1475,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.455 2017/08/15 16:14:04 stroeder Exp $ +$Id: CHANGES,v 1.456 2017/08/16 13:29:05 stroeder Exp $ diff --git a/Lib/slapdtest.py b/Lib/slapdtest.py index 7a02492..c3502d1 100644 --- a/Lib/slapdtest.py +++ b/Lib/slapdtest.py @@ -4,7 +4,7 @@ See https://www.python-ldap.org/ for details. -$Id: slapdtest.py,v 1.18 2017/08/15 17:18:54 stroeder Exp $ +$Id: slapdtest.py,v 1.19 2017/08/16 13:29:06 stroeder Exp $ Python compability note: This module only works with Python 2.7.x since @@ -83,7 +83,7 @@ class SlapdObject(object): Controller class for a slapd instance, OpenLDAP's server. This class creates a temporary data store for slapd, runs it - on a private port, and initialises it with a top-level dc and + listening on a private Unix domain socket and TCP port, and initialises it with a top-level entry and the root user. When a reference to an instance of this class is lost, the slapd @@ -132,9 +132,12 @@ def __init__(self): ldapi_path = os.path.join(self.testrundir, 'ldapi') self.ldapi_uri = "ldapi://%s" % urllib.quote_plus(ldapi_path) - def _setup_rundir(self): + def setup_rundir(self): """ creates rundir structure + + for setting up a custom directory structure you have to override + this method """ os.mkdir(self.testrundir) os.mkdir(self._db_directory) @@ -172,9 +175,12 @@ def _avail_tcp_port(self): self._log.info('Found available port %d', port) return port - def _gen_config(self): + def gen_config(self): """ generates a slapd.conf and returns it as one string + + for generating specific static configuration files you have to + override this method """ config_dict = { 'serverid': hex(self.server_id), @@ -213,7 +219,7 @@ 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(self._gen_config()) + config_file.write(self.gen_config()) config_file.close() self._log.info('Wrote config to %s', self._slapd_conf) @@ -271,7 +277,7 @@ def start(self): if self._proc is None: # prepare directory structure self._cleanup_rundir() - self._setup_rundir() + self.setup_rundir() self._write_config() self._test_config() self._start_slapd()