Commit a2dec438 authored by Alain Takoudjou's avatar Alain Takoudjou

BOINC make_project: avoid accidental destruction project

parent c658d8ca
...@@ -151,17 +151,20 @@ class Recipe(GenericBaseRecipe): ...@@ -151,17 +151,20 @@ class Recipe(GenericBaseRecipe):
self.mysqlhost, "--user_name", slapuser, "--srcdir", self.mysqlhost, "--user_name", slapuser, "--srcdir",
self.sourcedir, "--no_query"] self.sourcedir, "--no_query"]
drop_install = self.haschanges() drop_install = self.haschanges()
request_make_boinc = os.path.join(self.home, '.make_project')
if drop_install: if drop_install:
#Allow to restart Boinc installation from the begining #Allow to restart Boinc installation from the begining
launch_args += ["--delete_prev_inst", "--drop_db_first"] launch_args += ["--delete_prev_inst", "--drop_db_first"]
open(request_make_boinc, 'w').write('Make Requested')
if os.path.exists(readme_file): if os.path.exists(readme_file):
os.unlink(readme_file) os.unlink(readme_file)
launch_args += [self.project, niceprojectname] launch_args += [self.project, niceprojectname]
install_wrapper = self.createPythonScript(os.path.join(self.wrapperdir, install_wrapper = self.createPythonScript(
'make_project'), os.path.join(self.wrapperdir, 'make_project'),
'slapos.recipe.librecipe.execute.executee_wait', '%s.configure.makeProject' % __name__,
(launch_args, [file_status], environment) dict(launch_args=launch_args, request_file=request_make_boinc,
make_sig=file_status, env=environment)
) )
path_list.append(install_wrapper) path_list.append(install_wrapper)
......
...@@ -122,6 +122,21 @@ def startProcess(launch_args, env=None, cwd=None, stdout=subprocess.PIPE): ...@@ -122,6 +122,21 @@ def startProcess(launch_args, env=None, cwd=None, stdout=subprocess.PIPE):
return False return False
return True return True
def makeProject(args):
"""Run BOINC make_project script but once only"""
#Wait for DateBase initialization...
checkFile(args['make_sig'], 3)
print "Cheking if needed to run BOINC make_project..."
if os.path.exists(args['request_file']):
env = os.environ
env['PATH'] = args['env']['PATH']
env['PYTHONPATH'] = args['env']['PYTHONPATH']
if startProcess(args['launch_args'], env=env):
os.unlink(args['request_file'])
print "Finished running BOINC make_projet...Ending"
else:
print "No new request for make_project. Exiting..."
def services(args): def services(args):
"""This function configure a new installed boinc project instance""" """This function configure a new installed boinc project instance"""
......
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