Commit 3b58586c authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: sup_process functions now return command status from supervisorctl calls

parent 5fa5d4dd
......@@ -44,7 +44,7 @@ def runProcess(config, process):
Start a process registered by supervisor
"""
server = xmlrpclib.Server(config['supervisord_server'])
server.supervisor.startProcess(process)
return server.supervisor.startProcess(process)
def runProcesses(config, processes):
......@@ -63,16 +63,21 @@ def stopProcess(config, process):
"""
if isRunning(config, process):
server = xmlrpclib.Server(config['supervisord_server'])
server.supervisor.stopProcess(process)
return server.supervisor.stopProcess(process)
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'])
return_status_list = []
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):
......
......@@ -231,7 +231,7 @@ def startProxy(config):
if sup_process.isRunning(config, 'slapproxy'):
return
try:
sup_process.runProcess(config, "slapproxy")
return sup_process.runProcess(config, "slapproxy")
except xmlrpclib.Fault:
pass
time.sleep(4)
......@@ -239,7 +239,7 @@ def startProxy(config):
def stopProxy(config):
"""Stop Slapproxy server"""
sup_process.stopProcess(config, "slapproxy")
return sup_process.stopProcess(config, "slapproxy")
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