Commit 6e4cf8c3 authored by Nicolas Wavrant's avatar Nicolas Wavrant

slaprunner: automatic deployment of a default software release,

given in the parameters, at first run
parent 674ad139
......@@ -11,7 +11,7 @@ import os
import slapos.runner.process
import sys
from slapos.runner.utils import runInstanceWithLock
from utils import cloneDefaultGit
from utils import cloneDefaultGit, setupDefaultSR
class Parser(OptionParser):
......@@ -152,8 +152,9 @@ def serve(config):
os.mkdir(software_link)
slapos.runner.process.setHandler()
config.logger.info('Running slapgrid...')
cloneDefaultGit(app.config)
runInstanceWithLock(app.config)
cloneDefaultGit(app.config)
setupDefaultSR(app.config)
config.logger.info('Done.')
app.wsgi_app = ProxyFix(app.wsgi_app)
app.run(host=config.runner_host, port=int(config.runner_port),
......
......@@ -815,3 +815,10 @@ def cloneDefaultGit(config):
'repo': 'http://git.erp5.org/repos/slapos.git',
}
cloneRepo(data)
def setupDefaultSR(config):
"""If a default_sr is in the parameters,
and no SR is deployed yet, setup it"""
project = os.path.join(config['etc_dir'], '.project')
if not os.path.exists(project) and config['default_sr'] != '':
configNewSR(config, config['default_sr'])
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