Skip to content

Commit cdc169a

Browse files
author
stroeder
committed
SlapdObject methods setup_rundir() and gen_config() are now "public" methods
1 parent 351452e commit cdc169a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

CHANGES

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Changes since 2.4.41:
66
Lib/
77
* added new SlapdObject methods _ln_schema_files() and
88
_create_sub_dirs()
9+
* SlapdObject methods setup_rundir() and gen_config()
10+
are now "public" methods
911
* removed pseudo test script from module ldap.cidict
1012

1113
Tests/
@@ -1473,4 +1475,4 @@ Released 2.0.0pre02 2002-02-01
14731475
----------------------------------------------------------------
14741476
Released 1.10alpha3 2000-09-19
14751477

1476-
$Id: CHANGES,v 1.455 2017/08/15 16:14:04 stroeder Exp $
1478+
$Id: CHANGES,v 1.456 2017/08/16 13:29:05 stroeder Exp $

Lib/slapdtest.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
See https://www.python-ldap.org/ for details.
66
7-
$Id: slapdtest.py,v 1.18 2017/08/15 17:18:54 stroeder Exp $
7+
$Id: slapdtest.py,v 1.19 2017/08/16 13:29:06 stroeder Exp $
88
99
Python compability note:
1010
This module only works with Python 2.7.x since
@@ -83,7 +83,7 @@ class SlapdObject(object):
8383
Controller class for a slapd instance, OpenLDAP's server.
8484
8585
This class creates a temporary data store for slapd, runs it
86-
on a private port, and initialises it with a top-level dc and
86+
listening on a private Unix domain socket and TCP port, and initialises it with a top-level entry and
8787
the root user.
8888
8989
When a reference to an instance of this class is lost, the slapd
@@ -132,9 +132,12 @@ def __init__(self):
132132
ldapi_path = os.path.join(self.testrundir, 'ldapi')
133133
self.ldapi_uri = "ldapi://%s" % urllib.quote_plus(ldapi_path)
134134

135-
def _setup_rundir(self):
135+
def setup_rundir(self):
136136
"""
137137
creates rundir structure
138+
139+
for setting up a custom directory structure you have to override
140+
this method
138141
"""
139142
os.mkdir(self.testrundir)
140143
os.mkdir(self._db_directory)
@@ -172,9 +175,12 @@ def _avail_tcp_port(self):
172175
self._log.info('Found available port %d', port)
173176
return port
174177

175-
def _gen_config(self):
178+
def gen_config(self):
176179
"""
177180
generates a slapd.conf and returns it as one string
181+
182+
for generating specific static configuration files you have to
183+
override this method
178184
"""
179185
config_dict = {
180186
'serverid': hex(self.server_id),
@@ -213,7 +219,7 @@ def _write_config(self):
213219
"""Writes the slapd.conf file out, and returns the path to it."""
214220
self._log.debug('Writing config to %s', self._slapd_conf)
215221
config_file = file(self._slapd_conf, 'wb')
216-
config_file.write(self._gen_config())
222+
config_file.write(self.gen_config())
217223
config_file.close()
218224
self._log.info('Wrote config to %s', self._slapd_conf)
219225

@@ -271,7 +277,7 @@ def start(self):
271277
if self._proc is None:
272278
# prepare directory structure
273279
self._cleanup_rundir()
274-
self._setup_rundir()
280+
self.setup_rundir()
275281
self._write_config()
276282
self._test_config()
277283
self._start_slapd()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy