Commit 54e24dea authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

runner: do not use output from Popen for logging slapgrid commands

parent 5ee2f320
...@@ -282,13 +282,15 @@ def runSoftwareWithLock(config, lock=True): ...@@ -282,13 +282,15 @@ def runSoftwareWithLock(config, lock=True):
os.mkdir(config['software_root']) os.mkdir(config['software_root'])
stopProxy(config) stopProxy(config)
startProxy(config) startProxy(config)
logfile = open(config['software_log'], 'w') # XXX Hackish and unreliable
if os.path.exists(config['software_log']):
os.remove(config['software_log'])
if not updateProxy(config): if not updateProxy(config):
return False return False
slapgrid = Popen([config['slapos'], 'node', 'software', '--all', slapgrid = Popen([config['slapos'], 'node', 'software', '--all',
'--cfg', config['slapos_cfg'], '--pidfile', slapgrid_pid, '--cfg', config['slapos_cfg'], '--pidfile', slapgrid_pid,
'--verbose', '--logfile', config['software_log']], '--verbose', '--logfile', config['software_log']],
stdout=logfile, name='slapgrid-sr') name='slapgrid-sr')
if lock: if lock:
slapgrid.wait() slapgrid.wait()
#Saves the current compile software for re-use #Saves the current compile software for re-use
...@@ -370,13 +372,15 @@ def runInstanceWithLock(config, lock=True): ...@@ -370,13 +372,15 @@ def runInstanceWithLock(config, lock=True):
slapgrid_pid = os.path.join(config['run_dir'], 'slapgrid-cp.pid') slapgrid_pid = os.path.join(config['run_dir'], 'slapgrid-cp.pid')
startProxy(config) startProxy(config)
logfile = open(config['instance_log'], 'w') # XXX Hackish and unreliable
if os.path.exists(config['instance_log']):
os.remove(config['instance_log'])
if not (updateProxy(config) and requestInstance(config)): if not (updateProxy(config) and requestInstance(config)):
return False return False
slapgrid = Popen([config['slapos'], 'node', 'instance', '--all', slapgrid = Popen([config['slapos'], 'node', 'instance', '--all',
'--cfg', config['slapos_cfg'], '--pidfile', slapgrid_pid, '--cfg', config['slapos_cfg'], '--pidfile', slapgrid_pid,
'--verbose', '--logfile', config['instance_log']], '--verbose', '--logfile', config['instance_log']],
stdout=logfile, name='slapgrid-cp') name='slapgrid-cp')
if lock: if lock:
slapgrid.wait() slapgrid.wait()
return ( True if slapgrid.returncode == 0 else False ) return ( True if slapgrid.returncode == 0 else False )
......
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