Skip to content

Commit

Permalink
slapdtest.SlapdObject.restart() just restarts slapd without cleaning …
Browse files Browse the repository at this point in the history
…any data
  • Loading branch information
stroeder committed Nov 7, 2017
1 parent e9aeb11 commit 0829d52
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Released 2.4.46 2017-11-xx
Changes since 2.4.45:

Lib/
*
* slapdtest.SlapdObject.restart() just restarts slapd
without cleaning any data

Tests/
*
Expand Down
14 changes: 8 additions & 6 deletions Lib/slapdtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ def start(self):
)

def stop(self):
"""Stops the slapd server, and waits for it to terminate"""
"""
Stops the slapd server, and waits for it to terminate and cleans up
"""
if self._proc is not None:
self._log.debug('stopping slapd with pid %d', self._proc.pid)
self._proc.terminate()
Expand All @@ -294,11 +296,11 @@ def stop(self):

def restart(self):
"""
Restarts the slapd server; ERASING previous content.
Starts the server even it if isn't already running.
Restarts the slapd server with same data
"""
self.stop()
self.start()
self._proc.terminate()
self.wait()
self._start_slapd()

def wait(self):
"""Waits for the slapd process to terminate by itself."""
Expand All @@ -309,7 +311,7 @@ def wait(self):
def _stopped(self):
"""Called when the slapd server is known to have terminated"""
if self._proc is not None:
self._log.info('slapd terminated')
self._log.info('slapd[%d] terminated', self._proc.pid)
self._proc = None

def _cli_auth_args(self):
Expand Down

0 comments on commit 0829d52

Please sign in to comment.