Commit 2455d6c4 authored by Nicolas Wavrant's avatar Nicolas Wavrant

slaprunner: new call parameter for runSoftwareWithLock and runInstanceWithLock

so they do not always lock the process until the end of slapgrid.
Moreover, they now only return True if slapgrid ends succesfully
parent 06774916
...@@ -235,7 +235,7 @@ def isSoftwareRunning(config=None): ...@@ -235,7 +235,7 @@ def isSoftwareRunning(config=None):
return isRunning('slapgrid-sr') return isRunning('slapgrid-sr')
def runSoftwareWithLock(config): def runSoftwareWithLock(config, lock=True):
""" """
Use Slapgrid to compile current Software Release and wait until Use Slapgrid to compile current Software Release and wait until
compilation is done compilation is done
...@@ -260,10 +260,13 @@ def runSoftwareWithLock(config): ...@@ -260,10 +260,13 @@ def runSoftwareWithLock(config):
config['configuration_file_path'], '--now', '--develop'], config['configuration_file_path'], '--now', '--develop'],
stdout=logfile, env=environment, stdout=logfile, env=environment,
name='slapgrid-sr') name='slapgrid-sr')
slapgrid.wait() if lock:
#Saves the current compile software for re-use slapgrid.wait()
config_SR_folder(config) #Saves the current compile software for re-use
return True config_SR_folder(config)
return ( True if slapgrid.returncode == 0 else False )
else:
return False
def config_SR_folder(config): def config_SR_folder(config):
...@@ -328,7 +331,7 @@ def isInstanceRunning(config=None): ...@@ -328,7 +331,7 @@ def isInstanceRunning(config=None):
return isRunning('slapgrid-cp') return isRunning('slapgrid-cp')
def runInstanceWithLock(config): def runInstanceWithLock(config, lock=True):
""" """
Use Slapgrid to deploy current Software Release and wait until Use Slapgrid to deploy current Software Release and wait until
deployment is done. deployment is done.
...@@ -345,8 +348,11 @@ def runInstanceWithLock(config): ...@@ -345,8 +348,11 @@ def runInstanceWithLock(config):
'--pidfile', slapgrid_pid, '--pidfile', slapgrid_pid,
config['configuration_file_path'], '--now'], config['configuration_file_path'], '--now'],
stdout=logfile, name='slapgrid-cp') stdout=logfile, name='slapgrid-cp')
slapgrid.wait() if lock:
return True slapgrid.wait()
return ( True if slapgrid.returncode == 0 else False )
else:
return False
def getProfilePath(projectDir, profile): def getProfilePath(projectDir, profile):
......
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