Commit 1727fa3f authored by Sebastien Robin's avatar Sebastien Robin

rebuild software if there is a failure in order to not

have to restart processes manually
parent d373ff40
from setuptools import setup, find_packages from setuptools import setup, find_packages
name = "erp5.recipe.testnode" name = "erp5.recipe.testnode"
version = '1.0.11' version = '1.0.13'
def read(name): def read(name):
return open(name).read() return open(name).read()
......
...@@ -6,6 +6,7 @@ import slapos.slap ...@@ -6,6 +6,7 @@ import slapos.slap
import subprocess import subprocess
import sys import sys
import socket import socket
import pprint
from SlapOSControler import SlapOSControler from SlapOSControler import SlapOSControler
...@@ -92,6 +93,7 @@ repository = %(repository_path)s ...@@ -92,6 +93,7 @@ repository = %(repository_path)s
profile_content += "\nbranch = %s" % branch profile_content += "\nbranch = %s" % branch
custom_profile.write(profile_content) custom_profile.write(profile_content)
custom_profile.close() custom_profile.close()
retry_software = False
try: try:
while True: while True:
# Make sure we have local repository # Make sure we have local repository
...@@ -107,9 +109,10 @@ repository = %(repository_path)s ...@@ -107,9 +109,10 @@ repository = %(repository_path)s
updater = Updater(repository_path, git_binary=config['git_binary']) updater = Updater(repository_path, git_binary=config['git_binary'])
updater.checkout() updater.checkout()
revision = updater.getRevision() revision = updater.getRevision()
if previous_revision == revision: if not(retry_software) and previous_revision == revision:
time.sleep(120) time.sleep(120)
continue continue
retry_software = False
previous_revision = revision previous_revision = revision
print config print config
...@@ -140,17 +143,16 @@ repository = %(repository_path)s ...@@ -140,17 +143,16 @@ repository = %(repository_path)s
# Now prepare the installation of SlapOS # Now prepare the installation of SlapOS
slapos_controler = SlapOSControler(config, slapos_controler = SlapOSControler(config,
process_group_pid_list=process_group_pid_list) process_group_pid_list=process_group_pid_list)
if run_software: # this should be always true later, but it is too slow for now
# this should be always true later, but it is too slow for now status_dict = slapos_controler.runSoftwareRelease(config,
status_dict = slapos_controler.runSoftwareRelease(config, environment=config['environment'],
environment=config['environment'], process_group_pid_list=process_group_pid_list,
process_group_pid_list=process_group_pid_list, )
) if status_dict['status_code'] != 0:
if status_dict['status_code'] != 0: safeRpcCall(master.reportTaskFailure,
safeRpcCall(master.reportTaskFailure, test_result_path, status_dict, config['test_suite_title'])
test_result_path, status_dict, config['test_suite_title']) retry_software = True
continue continue
run_software = False
# create instances, it should take some seconds only # create instances, it should take some seconds only
slapos_controler.runComputerPartition(config, slapos_controler.runComputerPartition(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