Commit 01844142 authored by Jérome Perrin's avatar Jérome Perrin

testnode: Use tempfile to generate a random socket path for slapos supervisord

parent ea28b5f8
...@@ -35,6 +35,7 @@ import sys ...@@ -35,6 +35,7 @@ import sys
import glob import glob
import argparse import argparse
import json import json
import tempfile
from slapos import client from slapos import client
MAX_PARTIONS = 10 MAX_PARTIONS = 10
...@@ -256,8 +257,16 @@ class SlapOSControler(object): ...@@ -256,8 +257,16 @@ class SlapOSControler(object):
self.log('SlapOSControler, initialize, reset_software: %r' % reset_software) self.log('SlapOSControler, initialize, reset_software: %r' % reset_software)
config = self.config config = self.config
slapos_config_dict = self.config.copy() slapos_config_dict = self.config.copy()
supervisord_socket = os.path.join(self.instance_root, 'supervisord.socket')
if len(supervisord_socket) >= 80:
# We want to avoid AF_UNIX path too long error.
supervisord_socket = '%s-supervisord.socket' % tempfile.mktemp()
self.log('Using shorter supervisord_socket %s' % supervisord_socket)
slapos_config_dict.update(software_root=self.software_root, slapos_config_dict.update(software_root=self.software_root,
instance_root=self.instance_root, instance_root=self.instance_root,
supervisord_socket=supervisord_socket,
proxy_database=self.proxy_database) proxy_database=self.proxy_database)
open(self.slapos_config, 'w').write(pkg_resources.resource_string( open(self.slapos_config, 'w').write(pkg_resources.resource_string(
'erp5.util.testnode', 'template/slapos.cfg.in') % 'erp5.util.testnode', 'template/slapos.cfg.in') %
......
...@@ -4,8 +4,10 @@ instance_root = %(instance_root)s ...@@ -4,8 +4,10 @@ instance_root = %(instance_root)s
master_url = %(master_url)s master_url = %(master_url)s
computer_id = %(computer_id)s computer_id = %(computer_id)s
root_check = False root_check = False
supervisord_socket = %(supervisord_socket)s
[slapproxy] [slapproxy]
host = %(proxy_host)s host = %(proxy_host)s
port = %(proxy_port)s port = %(proxy_port)s
database_uri = %(proxy_database)s database_uri = %(proxy_database)s
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