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 ...@@ -11,7 +11,7 @@ import os
import slapos.runner.process import slapos.runner.process
import sys import sys
from slapos.runner.utils import runInstanceWithLock from slapos.runner.utils import runInstanceWithLock
from utils import cloneDefaultGit from utils import cloneDefaultGit, setupDefaultSR
class Parser(OptionParser): class Parser(OptionParser):
...@@ -152,8 +152,9 @@ def serve(config): ...@@ -152,8 +152,9 @@ def serve(config):
os.mkdir(software_link) os.mkdir(software_link)
slapos.runner.process.setHandler() slapos.runner.process.setHandler()
config.logger.info('Running slapgrid...') config.logger.info('Running slapgrid...')
cloneDefaultGit(app.config)
runInstanceWithLock(app.config) runInstanceWithLock(app.config)
cloneDefaultGit(app.config)
setupDefaultSR(app.config)
config.logger.info('Done.') config.logger.info('Done.')
app.wsgi_app = ProxyFix(app.wsgi_app) app.wsgi_app = ProxyFix(app.wsgi_app)
app.run(host=config.runner_host, port=int(config.runner_port), app.run(host=config.runner_host, port=int(config.runner_port),
......
...@@ -815,3 +815,10 @@ def cloneDefaultGit(config): ...@@ -815,3 +815,10 @@ def cloneDefaultGit(config):
'repo': 'http://git.erp5.org/repos/slapos.git', 'repo': 'http://git.erp5.org/repos/slapos.git',
} }
cloneRepo(data) 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