[FIX] runbot: escape server name in nginx config

This commit is contained in:
Christophe Simonis 2017-06-30 12:00:19 +02:00
parent 3339d20520
commit f22ca0d212
2 changed files with 2 additions and 1 deletions

View File

@ -418,6 +418,7 @@ class runbot_repo(osv.osv):
settings['runbot_static'] = os.path.join(get_module_resource('runbot', 'static'), '')
nginx_dir = os.path.join(self._root(cr, uid), 'nginx')
settings['nginx_dir'] = nginx_dir
settings['re_escape'] = re.escape
ids = self.search(cr, uid, [('nginx','=',True)], order='id')
if ids:
build_ids = self.pool['runbot.build'].search(cr, uid, [('repo_id','in',ids), ('state','=','running')])

View File

@ -704,7 +704,7 @@ http {
<t t-foreach="builds" t-as="build">
server {
listen 8080;
server_name ~^<t t-esc="build.dest"/>[-.].*$;
server_name ~^<t t-raw="re_escpace(build.dest)"/>[-.].*$;
location / { proxy_pass http://127.0.0.1:<t t-esc="build.port"/>; }
location /longpolling { proxy_pass http://127.0.0.1:<t t-esc="build.port + 1"/>; }
}