Commit d13ea3cb authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: sup_process functions now return command status from supervisorctl calls

parent 2282ddda
...@@ -44,7 +44,7 @@ def runProcess(config, process): ...@@ -44,7 +44,7 @@ def runProcess(config, process):
Start a process registered by supervisor Start a process registered by supervisor
""" """
server = xmlrpclib.Server(config['supervisord_server']) server = xmlrpclib.Server(config['supervisord_server'])
server.supervisor.startProcess(process) return server.supervisor.startProcess(process)
def runProcesses(config, processes): def runProcesses(config, processes):
...@@ -63,16 +63,21 @@ def stopProcess(config, process): ...@@ -63,16 +63,21 @@ def stopProcess(config, process):
""" """
if isRunning(config, process): if isRunning(config, process):
server = xmlrpclib.Server(config['supervisord_server']) server = xmlrpclib.Server(config['supervisord_server'])
server.supervisor.stopProcess(process) return server.supervisor.stopProcess(process)
def stopProcesses(config, processes): def stopProcesses(config, processes):
""" """
Stop a list of processes Stop a list of processes.
Returns True if all the processes have ended correctly.
Returns False if at least one process didn't stop correctly.
""" """
server = xmlrpclib.Server(config['supervisord_server']) server = xmlrpclib.Server(config['supervisord_server'])
return_status_list = []
for proc in processes: for proc in processes:
server.supervisor.stopProcess(proc) return_status_list.append(server.supervisor.stopProcess(proc))
return len(return_status_list) == sum(return_status_list)
def waitForProcessEnd(config, process): def waitForProcessEnd(config, process):
......
...@@ -231,7 +231,7 @@ def startProxy(config): ...@@ -231,7 +231,7 @@ def startProxy(config):
if sup_process.isRunning(config, 'slapproxy'): if sup_process.isRunning(config, 'slapproxy'):
return return
try: try:
sup_process.runProcess(config, "slapproxy") return sup_process.runProcess(config, "slapproxy")
except xmlrpclib.Fault: except xmlrpclib.Fault:
pass pass
time.sleep(4) time.sleep(4)
...@@ -239,7 +239,7 @@ def startProxy(config): ...@@ -239,7 +239,7 @@ def startProxy(config):
def stopProxy(config): def stopProxy(config):
"""Stop Slapproxy server""" """Stop Slapproxy server"""
sup_process.stopProcess(config, "slapproxy") return sup_process.stopProcess(config, "slapproxy")
def removeProxyDb(config): def removeProxyDb(config):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment