Commit 8ca71abc authored by Alain Takoudjou's avatar Alain Takoudjou

runner: always keep slapproxy running

Start slapproxy at runner startup and when instance is removed in webrunner. This fix resiliency problem when proxy.db file does not exist.

/reviewed-on nexedi/slapos.toolbox!36
parent cf15a299
...@@ -12,7 +12,7 @@ import urlparse ...@@ -12,7 +12,7 @@ import urlparse
from slapos.htpasswd import HtpasswdFile from slapos.htpasswd import HtpasswdFile
from slapos.runner.process import setHandler from slapos.runner.process import setHandler
import sys import sys
from slapos.runner.utils import runInstanceWithLock from slapos.runner.utils import runInstanceWithLock, startProxy
from slapos.runner.views import * from slapos.runner.views import *
from slapos.runner.gittools import cloneRepo, switchBranch from slapos.runner.gittools import cloneRepo, switchBranch
from git import GitCommandError from git import GitCommandError
...@@ -147,6 +147,9 @@ def serve(config): ...@@ -147,6 +147,9 @@ def serve(config):
except GitCommandError, e: except GitCommandError, e:
app.logger.warning('Error while cloning default repository: %s' % str(e)) app.logger.warning('Error while cloning default repository: %s' % str(e))
traceback.print_exc() traceback.print_exc()
# Start slapproxy here when runner is starting
app.logger.info('Stating slapproxy...')
startProxy(app.config)
app.logger.info('Running slapgrid...') app.logger.info('Running slapgrid...')
if app.config['auto_deploy_instance'] in TRUE_VALUES: if app.config['auto_deploy_instance'] in TRUE_VALUES:
import thread import thread
......
...@@ -473,6 +473,7 @@ def removeCurrentInstance(config): ...@@ -473,6 +473,7 @@ def removeCurrentInstance(config):
svcStopAll(config) svcStopAll(config)
if stopProxy(config): if stopProxy(config):
removeProxyDb(config) removeProxyDb(config)
startProxy(config)
else: else:
return "Something went wrong when trying to stop slapproxy." return "Something went wrong when trying to stop slapproxy."
......
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