Commit 0f38ef39 authored by Nicolas Wavrant's avatar Nicolas Wavrant

fix on the last added function (cloneDefaultGit)

parent a928b0b9
......@@ -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
class Parser(OptionParser):
......@@ -121,8 +121,6 @@ def run():
# avoid mistakes (mainly in development mode)
raise Exception('Do not run SlapRunner as root.')
cloneDefaultgit()
serve(config)
return_code = 0
except SystemExit as err:
......@@ -152,6 +150,7 @@ def serve(config):
os.mkdir(workdir)
if not os.path.exists(software_link):
os.mkdir(software_link)
cloneDefaultGit(app.config)
slapos.runner.process.setHandler()
config.logger.info('Running slapgrid...')
runInstanceWithLock(app.config)
......
......@@ -805,14 +805,14 @@ def readParameters(path):
return "No such file or directory: %s" % path
def cloneDefaultGit():
def cloneDefaultGit(config):
"""Test if the slapos git has been downloaded yet
If not, download it in read-only mode"""
slap = os.path.join(config.runner_workdir, 'project', 'slapos')
slap_ro = os.path.join(config.runner_workdir, 'project', 'slapos-readonly')
slap = os.path.join(config['runner_workdir'], 'project', 'slapos')
slap_ro = os.path.join(config['runner_workdir'], 'project', 'slapos-readonly')
if not os.path.exists(slap_ro) or not os.path.exists(slap_ro):
from gittools import cloneRepo
user = open(os.path.join(config.etc_dir, '.users')).read().split(';')
user = getSession(config)
data = {'path': slap_ro,
'repo': 'http://git.erp5.org/repos/slapos.git',
'email': user[2],
......
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