Commit a928b0b9 by Nicolas Wavrant

new function in

clone the git repo of slapos by default (if it is not present), when the runner is launched
parent af2b25ac
......@@ -11,6 +11,7 @@ import os
import slapos.runner.process
import sys
from slapos.runner.utils import runInstanceWithLock
from utils import cloneDefaultgit
class Parser(OptionParser):
......@@ -120,6 +121,8 @@ def run():
# avoid mistakes (mainly in development mode)
raise Exception('Do not run SlapRunner as root.')
return_code = 0
except SystemExit as err:
......@@ -803,3 +803,19 @@ def readParameters(path):
return str(e)
return "No such file or directory: %s" % path
def cloneDefaultGit():
"""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')
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(';')
data = {'path': slap_ro,
'repo': '',
'email': user[2],
'user': user[3],
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 sign in to comment