Commit 91d80971 authored by Łukasz Nowak's avatar Łukasz Nowak

Fill backend list.

parent 03fc2d81
......@@ -44,10 +44,6 @@ class Recipe(GenericSlapRecipe):
current_zope_port = ZOPE_PORT_BASE
current_apache_port = APACHE_PORT_BASE
current_haproxy_port = HAPROXY_PORT_BASE
num = 1
for l in self.parameter_dict['json'].splitlines():
print '%3s %s' % (num, l)
num +=1
json_data = json.loads(self.parameter_dict['json'])
site_id = str(json_data['site-id'])
# prepare zeo
......@@ -109,11 +105,13 @@ class Recipe(GenericSlapRecipe):
# handle backend key
snippet_backend = open(self.options['snippet-backend']).read()
for backend_name, backend_configuration in json_data['backend'].iteritems():
haproxy_backend_list = []
for q in range(1, backend_configuration['zopecount'] + 1):
current_zope_port += 1
part_name = 'zope-%s-%s' % (backend_name, q)
part_list.append(part_name)
output += snippet_zope % dict(zope_thread_amount=backend_configuration['thread-amount'], zope_id=part_name, zope_port=current_zope_port, **zope_dict)
haproxy_backend_list.append('${%(part_name)s:ip}:${%(part_name)s:port}' % dict(part_name=part_name))
# now generate backend access
current_apache_port += 1
current_haproxy_port += 1
......@@ -124,7 +122,8 @@ class Recipe(GenericSlapRecipe):
haproxy_port=current_haproxy_port,
access_control_string=backend_configuration['access-control-string'],
maxconn=backend_configuration['maxconn'],
server_check_path='/%s/getId' % site_id
server_check_path='/%s/getId' % site_id,
haproxy_backend_list=' '.join(haproxy_backend_list)
)
output += snippet_backend % backend_dict
prepend = open(self.options['snippet-master']).read() % dict(
......
......@@ -29,6 +29,9 @@ allow-hosts =
www.dabeaz.com
www.owlfish.com
develop =
/opt/slapdev
extends =
# Exact version of Zope
http://svn.zope.org/repos/main/Zope/tags/2.12.20/versions.cfg
......
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