Commit b85c7f25 authored by Sebastien Robin's avatar Sebastien Robin Committed by Julien Muchembled

move stdout and stderr file creation in testnode

This will allows to use it for several different external method
calls
parent e8205d2f
......@@ -46,18 +46,12 @@ class SlapOSControler(object):
'reference': config['computer_id'],
'software_root': config['software_root']}))
def runSoftwareRelease(self, config, environment, process_group_pid_set=None):
def runSoftwareRelease(self, config, environment, process_group_pid_set=None,
stdout=None, stderr=None):
print "SlapOSControler.runSoftwareRelease"
cpu_count = os.sysconf("SC_NPROCESSORS_ONLN")
os.putenv('MAKEFLAGS', '-j%s' % cpu_count)
os.environ['PATH'] = environment['PATH']
stdout = open(os.path.join(
config['instance_root'],'.runSoftwareRelease_out'),
'w+')
stdout.write("SlapOSControler.runSoftwareRelease")
stderr = open(os.path.join(
config['instance_root'],'.runSoftwareRelease_err'),
'w+')
slapgrid = subprocess.Popen([config['slapgrid_software_binary'], '-v', '-c',
#'--buildout-parameter',"'-U -N' -o",
config['slapos_config']],
......
......@@ -55,6 +55,16 @@ def safeRpcCall(function, *args):
time.sleep(retry)
retry += retry >> 1
def getInputOutputFileList(config, command_name)
stdout = open(os.path.join(
config['instance_root'],'.%s_out' % command_name),
'w+')
stdout.write("%s\n" command_name)
stderr = open(os.path.join(
config['instance_root'],'.%s_err' % command_name),
'w+')
return (stdout, stderr)
slapos_controler = None
def run(args):
......@@ -171,10 +181,11 @@ branch = %(branch)s
# Now prepare the installation of SlapOS
slapos_controler = SlapOSControler(config,
process_group_pid_set=process_group_pid_set)
# this should be always true later, but it is too slow for now
stdout, stderr = getInputOutputFileList(config, "runSoftwareRelease")
status_dict = slapos_controler.runSoftwareRelease(config,
environment=config['environment'],
process_group_pid_set=process_group_pid_set,
stdout=stdout, stderr=stderr
)
if status_dict['status_code'] != 0:
safeRpcCall(master.reportTaskFailure,
......
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