Commit cbefe5a4 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

ERP5: add support for Python 3

parent 678151d9
from __future__ import print_function
from . import ERP5InstanceTestCase from . import ERP5InstanceTestCase
from . import setUpModule from . import setUpModule
from slapos.testing.utils import findFreeTCPPort from slapos.testing.utils import findFreeTCPPort
from slapos.util import str2bytes
from BaseHTTPServer import HTTPServer from six.moves.BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from BaseHTTPServer import BaseHTTPRequestHandler
import OpenSSL.SSL import OpenSSL.SSL
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization, hashes from cryptography.hazmat.primitives import serialization, hashes
...@@ -16,9 +17,11 @@ import multiprocessing ...@@ -16,9 +17,11 @@ import multiprocessing
import os import os
import requests import requests
import shutil import shutil
import six
import subprocess import subprocess
import tempfile import tempfile
import time import time
from six.moves import range
setUpModule # pyflakes setUpModule # pyflakes
...@@ -28,11 +31,11 @@ class TestHandler(BaseHTTPRequestHandler): ...@@ -28,11 +31,11 @@ class TestHandler(BaseHTTPRequestHandler):
self.send_header("Content-Type", "application/json") self.send_header("Content-Type", "application/json")
response = { response = {
'Path': self.path, 'Path': self.path,
'Incoming Headers': self.headers.dict 'Incoming Headers': dict(self.headers.items()) if six.PY3 else self.headers.dict
} }
response = json.dumps(response, indent=2) response = json.dumps(response, indent=2)
self.end_headers() self.end_headers()
self.wfile.write(response) self.wfile.write(str2bytes(response))
class TestFrontendXForwardedFor(ERP5InstanceTestCase): class TestFrontendXForwardedFor(ERP5InstanceTestCase):
__partition_reference__ = 'xff' __partition_reference__ = 'xff'
...@@ -93,7 +96,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase): ...@@ -93,7 +96,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase):
cls.software_release_root_path = os.path.join( cls.software_release_root_path = os.path.join(
cls.slap._software_root, cls.slap._software_root,
hashlib.md5(cls.getSoftwareURL()).hexdigest(), hashlib.md5(str2bytes(cls.getSoftwareURL())).hexdigest(),
) )
caucased_path = os.path.join(cls.software_release_root_path, 'bin', 'caucased') caucased_path = os.path.join(cls.software_release_root_path, 'bin', 'caucased')
caucase_path = os.path.join(cls.software_release_root_path, 'bin', 'caucase') caucase_path = os.path.join(cls.software_release_root_path, 'bin', 'caucase')
...@@ -116,7 +119,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase): ...@@ -116,7 +119,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase):
pass pass
time.sleep(1) time.sleep(1)
else: else:
raise RuntimeError, 'caucased failed to start.' raise RuntimeError('caucased failed to start.')
cau_args = [ cau_args = [
caucase_path, caucase_path,
...@@ -145,7 +148,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase): ...@@ -145,7 +148,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase):
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
) )
result = caucase_process.communicate() result = caucase_process.communicate()
print result print(result)
csr_id = result[0].split()[0] csr_id = result[0].split()[0]
subprocess.check_call( subprocess.check_call(
...@@ -196,7 +199,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase): ...@@ -196,7 +199,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase):
else: else:
time.sleep(1) time.sleep(1)
else: else:
raise RuntimeError, 'getting service certificate failed.' raise RuntimeError('getting service certificate failed.')
# start a caucased and server certificate. # start a caucased and server certificate.
cls.backend_caucase_dir = tempfile.mkdtemp() cls.backend_caucase_dir = tempfile.mkdtemp()
...@@ -223,7 +226,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase): ...@@ -223,7 +226,7 @@ class TestFrontendXForwardedFor(ERP5InstanceTestCase):
pass pass
time.sleep(1) time.sleep(1)
else: else:
raise RuntimeError, 'caucased failed to start.' raise RuntimeError('caucased failed to start.')
super(TestFrontendXForwardedFor, cls).setUpClass() super(TestFrontendXForwardedFor, cls).setUpClass()
......
...@@ -28,12 +28,14 @@ ...@@ -28,12 +28,14 @@
import os import os
import json import json
import glob import glob
import urlparse from six.moves.urllib.parse import urljoin, urlparse
import socket import socket
import time import time
import psutil import psutil
import requests import requests
import six
from six.moves import map, range
from . import ERP5InstanceTestCase from . import ERP5InstanceTestCase
from . import setUpModule from . import setUpModule
...@@ -70,14 +72,14 @@ class TestPublishedURLIsReachableMixin(object): ...@@ -70,14 +72,14 @@ class TestPublishedURLIsReachableMixin(object):
""" """
param_dict = self.getRootPartitionConnectionParameterDict() param_dict = self.getRootPartitionConnectionParameterDict()
self._checkERP5IsReachable( self._checkERP5IsReachable(
urlparse.urljoin(param_dict['family-default-v6'], param_dict['site-id'])) urljoin(param_dict['family-default-v6'], param_dict['site-id']))
def test_published_family_default_v4_is_reachable(self): def test_published_family_default_v4_is_reachable(self):
"""Tests the IPv4 URL published by the root partition is reachable. """Tests the IPv4 URL published by the root partition is reachable.
""" """
param_dict = self.getRootPartitionConnectionParameterDict() param_dict = self.getRootPartitionConnectionParameterDict()
self._checkERP5IsReachable( self._checkERP5IsReachable(
urlparse.urljoin(param_dict['family-default'], param_dict['site-id'])) urljoin(param_dict['family-default'], param_dict['site-id']))
class TestDefaultParameters(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin): class TestDefaultParameters(ERP5InstanceTestCase, TestPublishedURLIsReachableMixin):
...@@ -122,7 +124,7 @@ class TestApacheBalancerPorts(ERP5InstanceTestCase): ...@@ -122,7 +124,7 @@ class TestApacheBalancerPorts(ERP5InstanceTestCase):
} }
def checkValidHTTPSURL(self, url): def checkValidHTTPSURL(self, url):
parsed = urlparse.urlparse(url) parsed = urlparse(url)
self.assertEqual(parsed.scheme, 'https') self.assertEqual(parsed.scheme, 'https')
self.assertTrue(parsed.hostname) self.assertTrue(parsed.hostname)
self.assertTrue(parsed.port) self.assertTrue(parsed.port)
...@@ -275,7 +277,7 @@ class TestZopeNodeParameterOverride(ERP5InstanceTestCase, TestPublishedURLIsReac ...@@ -275,7 +277,7 @@ class TestZopeNodeParameterOverride(ERP5InstanceTestCase, TestPublishedURLIsReac
storage["storage"] = "root" storage["storage"] = "root"
storage["server"] = zeo_addr storage["server"] = zeo_addr
with open('%s/etc/zope-%s.conf' % (partition, zope)) as f: with open('%s/etc/zope-%s.conf' % (partition, zope)) as f:
conf = map(str.strip, f.readlines()) conf = list(map(str.strip, f.readlines()))
i = conf.index("<zodb_db root>") + 1 i = conf.index("<zodb_db root>") + 1
conf = iter(conf[i:conf.index("</zodb_db>", i)]) conf = iter(conf[i:conf.index("</zodb_db>", i)])
for line in conf: for line in conf:
...@@ -284,23 +286,23 @@ class TestZopeNodeParameterOverride(ERP5InstanceTestCase, TestPublishedURLIsReac ...@@ -284,23 +286,23 @@ class TestZopeNodeParameterOverride(ERP5InstanceTestCase, TestPublishedURLIsReac
if line == '</zeoclient>': if line == '</zeoclient>':
break break
checkParameter(line, storage) checkParameter(line, storage)
for k, v in storage.iteritems(): for k, v in six.iteritems(storage):
self.assertIsNone(v, k) self.assertIsNone(v, k)
del storage del storage
else: else:
checkParameter(line, zodb) checkParameter(line, zodb)
for k, v in zodb.iteritems(): for k, v in six.iteritems(zodb):
self.assertIsNone(v, k) self.assertIsNone(v, k)
partition = self.getComputerPartitionPath('zope-a') partition = self.getComputerPartitionPath('zope-a')
for zope in xrange(3): for zope in range(3):
checkConf({ checkConf({
"cache-size-bytes": "20MB", "cache-size-bytes": "20MB",
}, { }, {
"cache-size": "50MB", "cache-size": "50MB",
}) })
partition = self.getComputerPartitionPath('zope-bb') partition = self.getComputerPartitionPath('zope-bb')
for zope in xrange(5): for zope in range(5):
checkConf({ checkConf({
"cache-size-bytes": "500MB" if zope else 1<<20, "cache-size-bytes": "500MB" if zope else 1<<20,
}, { }, {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
import os import os
import json import json
import glob import glob
import urlparse from six.moves.urllib.parse import urlparse
import socket import socket
import time import time
import contextlib import contextlib
...@@ -72,7 +72,7 @@ class MariaDBTestCase(ERP5InstanceTestCase): ...@@ -72,7 +72,7 @@ class MariaDBTestCase(ERP5InstanceTestCase):
def getDatabaseConnection(self): def getDatabaseConnection(self):
connection_parameter_dict = json.loads( connection_parameter_dict = json.loads(
self.computer_partition.getConnectionParameterDict()['_']) self.computer_partition.getConnectionParameterDict()['_'])
db_url = urlparse.urlparse(connection_parameter_dict['database-list'][0]) db_url = urlparse(connection_parameter_dict['database-list'][0])
self.assertEqual('mysql', db_url.scheme) self.assertEqual('mysql', db_url.scheme)
self.assertTrue(db_url.path.startswith('/')) self.assertTrue(db_url.path.startswith('/'))
...@@ -129,7 +129,7 @@ class TestMroonga(MariaDBTestCase): ...@@ -129,7 +129,7 @@ class TestMroonga(MariaDBTestCase):
""" """
SELECT mroonga_normalize("ABCDあぃうぇ㍑") SELECT mroonga_normalize("ABCDあぃうぇ㍑")
""") """)
self.assertEqual((('abcdあぃうぇリットル',),), self.assertEqual(((u'abcdあぃうぇリットル'.encode('utf-8'),),),
cnx.store_result().fetch_row(maxrows=2)) cnx.store_result().fetch_row(maxrows=2))
if 0: if 0:
...@@ -142,7 +142,7 @@ class TestMroonga(MariaDBTestCase): ...@@ -142,7 +142,7 @@ class TestMroonga(MariaDBTestCase):
""" """
SELECT mroonga_normalize("aBcDあぃウェ㍑", "NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark") SELECT mroonga_normalize("aBcDあぃウェ㍑", "NormalizerMySQLUnicodeCIExceptKanaCIKanaWithVoicedSoundMark")
""") """)
self.assertEqual((('ABCDあぃうぇ㍑',),), self.assertEqual(((u'ABCDあぃうぇ㍑'.encode('utf-8'),),),
cnx.store_result().fetch_row(maxrows=2)) cnx.store_result().fetch_row(maxrows=2))
def test_mroonga_full_text_normalizer(self): def test_mroonga_full_text_normalizer(self):
...@@ -230,7 +230,7 @@ class TestMroonga(MariaDBTestCase): ...@@ -230,7 +230,7 @@ class TestMroonga(MariaDBTestCase):
cnx = self.getDatabaseConnection() cnx = self.getDatabaseConnection()
with contextlib.closing(cnx): with contextlib.closing(cnx):
cnx.query("SELECT mroonga_command('register token_filters/stem')") cnx.query("SELECT mroonga_command('register token_filters/stem')")
self.assertEqual((('true',),), cnx.store_result().fetch_row(maxrows=2)) self.assertEqual(((b'true',),), cnx.store_result().fetch_row(maxrows=2))
cnx.query( cnx.query(
""" """
CREATE TABLE memos ( CREATE TABLE memos (
......
...@@ -18,7 +18,7 @@ md5sum = 6da513940e5bf7d06b3fb0aeb39c8ad5 ...@@ -18,7 +18,7 @@ md5sum = 6da513940e5bf7d06b3fb0aeb39c8ad5
[root-common] [root-common]
filename = root-common.cfg.in filename = root-common.cfg.in
md5sum = 8e28f599247ad604ec6e32df410412a8 md5sum = 9bbbcaca8adb6d034a35cd098e42ead7
[instance-neo-admin] [instance-neo-admin]
filename = instance-neo-admin.cfg.in filename = instance-neo-admin.cfg.in
...@@ -38,7 +38,7 @@ md5sum = 9f6f8f2b5f4cb0d97d50ffc1d3837e2f ...@@ -38,7 +38,7 @@ md5sum = 9f6f8f2b5f4cb0d97d50ffc1d3837e2f
[template-neo] [template-neo]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 9e63e16eda75e73ad4ffb50afde0505d md5sum = 3c7770c03c51ee12d5a94f0924e98990
[cluster] [cluster]
filename = cluster.cfg.in filename = cluster.cfg.in
......
...@@ -9,7 +9,7 @@ rendered = ${buildout:parts-directory}/${:_buildout_section_name_}.cfg ...@@ -9,7 +9,7 @@ rendered = ${buildout:parts-directory}/${:_buildout_section_name_}.cfg
template = {{ cluster }} template = {{ cluster }}
extra-context = extra-context =
import re re import re re
import urlparse urlparse import urllib_parse six.moves.urllib.parse
import-list = import-list =
rawfile root_common {{ root_common }} rawfile root_common {{ root_common }}
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
{% set part_list = [] -%} {% set part_list = [] -%}
{% set sla_dict = {} -%} {% set sla_dict = {} -%}
{% for sla, ref_list in slapparameter_dict.get('sla-dict', {}).iteritems() -%} {% for sla, ref_list in six.iteritems(slapparameter_dict.get('sla-dict', {})) -%}
{% do sla_dict.update(dict.fromkeys(ref_list, sla)) -%} {% do sla_dict.update(dict.fromkeys(ref_list, sla)) -%}
{% endfor -%} {% endfor -%}
{% macro sla(name, required=False) -%} {% macro sla(name, required=False) -%}
{% if required or name in sla_dict -%} {% if required or name in sla_dict -%}
{% for k, (v,) in urlparse.parse_qs(sla_dict.pop(name), strict_parsing=1).iteritems() -%} {% for k, (v,) in six.iteritems(urllib_parse.parse_qs(sla_dict.pop(name), strict_parsing=1)) -%}
sla-{{ k }} = {{ v }} sla-{{ k }} = {{ v }}
{% endfor -%} {% endfor -%}
{% else -%} {% else -%}
...@@ -132,7 +132,7 @@ config-monitor-port = {{ dumps(port) }} ...@@ -132,7 +132,7 @@ config-monitor-port = {{ dumps(port) }}
{%- endif %} {%- endif %}
config-monitor = {{ dumps(parameter_dict.get('monitor', {})) }} config-monitor = {{ dumps(parameter_dict.get('monitor', {})) }}
{%- endif %} {%- endif %}
{%- for k, v in node.iteritems() %} {%- for k, v in six.iteritems(node) %}
config-{{ k }} = {{ dumps(v) }} config-{{ k }} = {{ dumps(v) }}
{%- endfor %} {%- endfor %}
{{ sla(section_id) }} {{ sla(section_id) }}
......
...@@ -26,7 +26,7 @@ md5sum = d10b8e35b02b5391cf46bf0c7dbb1196 ...@@ -26,7 +26,7 @@ md5sum = d10b8e35b02b5391cf46bf0c7dbb1196
[template-mariadb] [template-mariadb]
filename = instance-mariadb.cfg.in filename = instance-mariadb.cfg.in
md5sum = bfed6ac56c3ba0e96be4c9474dac6f20 md5sum = 7fdf1a42b252f9dfdf3a05ebabf608f2
[template-kumofs] [template-kumofs]
filename = instance-kumofs.cfg.in filename = instance-kumofs.cfg.in
...@@ -34,7 +34,7 @@ md5sum = e91c0fbd0df441884f7422fa7976053c ...@@ -34,7 +34,7 @@ md5sum = e91c0fbd0df441884f7422fa7976053c
[template-zope-conf] [template-zope-conf]
filename = zope.conf.in filename = zope.conf.in
md5sum = c43da8f7b4db22e40a4864e6cfcaef44 md5sum = dedc3c3f09a09e4b3332869cab33e8db
[site-zcml] [site-zcml]
filename = site.zcml filename = site.zcml
...@@ -66,11 +66,11 @@ md5sum = 0969fbb25b05c02ef3c2d437b2f4e1a0 ...@@ -66,11 +66,11 @@ md5sum = 0969fbb25b05c02ef3c2d437b2f4e1a0
[template-run-zelenium] [template-run-zelenium]
filename = run-zelenium-test.py.in filename = run-zelenium-test.py.in
md5sum = cc19560b9400cecbd23064d55c501eec md5sum = 6afc237458fcc0538dd7971c2e90aa96
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 328ea2bb5f2bff18f8be8c541c01f260 md5sum = 87ac816fc7b5d0232e21e2cae2ac2840
[monitor-template-dummy] [monitor-template-dummy]
filename = dummy.cfg filename = dummy.cfg
...@@ -78,20 +78,20 @@ md5sum = 68b329da9893e34099c7d8ad5cb9c940 ...@@ -78,20 +78,20 @@ md5sum = 68b329da9893e34099c7d8ad5cb9c940
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = 82dc695e212be124d60ceb1143e56b0d md5sum = 0856d99bd78c1c35ae63459e991f7010
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
md5sum = 0648e38bd5d3a15bb9f93264932740b9 md5sum = 862d3b5309aa4d80bfa48703fcffbed0
[template-zope] [template-zope]
filename = instance-zope.cfg.in filename = instance-zope.cfg.in
md5sum = 2f3ddd328ac1c375e483ecb2ef5ffb57 md5sum = bb835a43675c6b7177895479864ba783
[template-balancer] [template-balancer]
filename = instance-balancer.cfg.in filename = instance-balancer.cfg.in
md5sum = 0097e49b5bd7ad4978c722c1cdd27d6c md5sum = 15663c41e0a7b74ebf3573e9e0835289
[template-haproxy-cfg] [template-haproxy-cfg]
filename = haproxy.cfg.in filename = haproxy.cfg.in
md5sum = fec6a312e4ef84b02837742992aaf495 md5sum = 3848f3b78811d72b7633973fad9c54e9
...@@ -32,7 +32,7 @@ defaults ...@@ -32,7 +32,7 @@ defaults
# to render a page # to render a page
option httpclose option httpclose
{% for name, (port, backend_list) in sorted(parameter_dict['backend-dict'].iteritems()) -%} {% for name, (port, backend_list) in sorted(six.iteritems(parameter_dict['backend-dict'])) -%}
listen {{ name }} listen {{ name }}
bind {{ parameter_dict['ip'] }}:{{ port }} bind {{ parameter_dict['ip'] }}:{{ port }}
http-request set-header X-Balancer-Current-Cookie SERVERID http-request set-header X-Balancer-Current-Cookie SERVERID
......
...@@ -41,7 +41,7 @@ mode = 644 ...@@ -41,7 +41,7 @@ mode = 644
{% set frontend_caucase_url_hash_list = [] -%} {% set frontend_caucase_url_hash_list = [] -%}
{% for frontend_caucase_url in frontend_caucase_url_list -%} {% for frontend_caucase_url in frontend_caucase_url_list -%}
{% set hash = hashlib.md5(frontend_caucase_url).hexdigest() -%} {% set hash = hashlib.md5(six.ensure_binary(frontend_caucase_url)).hexdigest() -%}
{% do frontend_caucase_url_hash_list.append(hash) -%} {% do frontend_caucase_url_hash_list.append(hash) -%}
{% set data_dir = '${directory:srv}/client-cert-ca/%s' % hash -%} {% set data_dir = '${directory:srv}/client-cert-ca/%s' % hash -%}
{{ caucase.updater( {{ caucase.updater(
...@@ -101,9 +101,9 @@ update-command = ${:command} ...@@ -101,9 +101,9 @@ update-command = ${:command}
{% set apache_dict = {} -%} {% set apache_dict = {} -%}
{% set zope_virtualhost_monster_backend_dict = {} %} {% set zope_virtualhost_monster_backend_dict = {} %}
{% set test_runner_url_dict = {} %} {# family_name => list of apache URLs #} {% set test_runner_url_dict = {} %} {# family_name => list of apache URLs #}
{% set next_port = itertools.count(slapparameter_dict['tcpv4-port']).next -%} {% set ports = itertools.count(slapparameter_dict['tcpv4-port']) -%}
{% for family_name, parameter_id_list in sorted( {% for family_name, parameter_id_list in sorted(
slapparameter_dict['zope-family-dict'].iteritems()) -%} six.iteritems(slapparameter_dict['zope-family-dict'])) -%}
{% set zope_family_address_list = [] -%} {% set zope_family_address_list = [] -%}
{% set ssl_authentication = slapparameter_dict['ssl-authentication-dict'].get(family_name, False) -%} {% set ssl_authentication = slapparameter_dict['ssl-authentication-dict'].get(family_name, False) -%}
{% set has_webdav = [] -%} {% set has_webdav = [] -%}
...@@ -122,7 +122,7 @@ update-command = ${:command} ...@@ -122,7 +122,7 @@ update-command = ${:command}
{% if test_runner_address_list -%} {% if test_runner_address_list -%}
{% set test_runner_backend_mapping = {} %} {% set test_runner_backend_mapping = {} %}
{% set test_runner_apache_url_list = [] %} {% set test_runner_apache_url_list = [] %}
{% set test_runner_external_port = next_port() %} {% set test_runner_external_port = next(ports) %}
{% for i, (test_runner_internal_ip, test_runner_internal_port) in enumerate(test_runner_address_list) %} {% for i, (test_runner_internal_ip, test_runner_internal_port) in enumerate(test_runner_address_list) %}
{% do test_runner_backend_mapping.__setitem__( {% do test_runner_backend_mapping.__setitem__(
'unit_test_' ~ i, 'unit_test_' ~ i,
...@@ -144,7 +144,7 @@ update-command = ${:command} ...@@ -144,7 +144,7 @@ update-command = ${:command}
# do a no-op getitem. # do a no-op getitem.
-#} -#}
{% do zope_family_address_list[0][0] -%} {% do zope_family_address_list[0][0] -%}
{% set haproxy_port = next_port() -%} {% set haproxy_port = next(ports) -%}
{% set backend_path = slapparameter_dict['backend-path-dict'][family_name] -%} {% set backend_path = slapparameter_dict['backend-path-dict'][family_name] -%}
{% do haproxy_dict.__setitem__(family_name, (haproxy_port, zope_family_address_list)) -%} {% do haproxy_dict.__setitem__(family_name, (haproxy_port, zope_family_address_list)) -%}
{% if has_webdav -%} {% if has_webdav -%}
...@@ -154,7 +154,7 @@ update-command = ${:command} ...@@ -154,7 +154,7 @@ update-command = ${:command}
{% set internal_scheme = 'http' -%} {% set internal_scheme = 'http' -%}
{% set external_scheme = 'https' -%} {% set external_scheme = 'https' -%}
{% endif -%} {% endif -%}
{% do apache_dict.__setitem__(family_name, (next_port(), external_scheme, internal_scheme ~ '://' ~ ipv4 ~ ':' ~ haproxy_port ~ backend_path, slapparameter_dict['ssl-authentication-dict'].get(family_name, False))) -%} {% do apache_dict.__setitem__(family_name, (next(ports), external_scheme, internal_scheme ~ '://' ~ ipv4 ~ ':' ~ haproxy_port ~ backend_path, slapparameter_dict['ssl-authentication-dict'].get(family_name, False))) -%}
{% endfor -%} {% endfor -%}
[haproxy-cfg-parameter-dict] [haproxy-cfg-parameter-dict]
...@@ -218,7 +218,7 @@ cert = ${apache-conf-ssl:cert} ...@@ -218,7 +218,7 @@ cert = ${apache-conf-ssl:cert}
{%- endif %} {%- endif %}
[apache-conf-parameter-dict] [apache-conf-parameter-dict]
backend-list = {{ dumps(apache_dict.values()) }} backend-list = {{ dumps(list(apache_dict.values())) }}
zope-virtualhost-monster-backend-dict = {{ dumps(zope_virtualhost_monster_backend_dict) }} zope-virtualhost-monster-backend-dict = {{ dumps(zope_virtualhost_monster_backend_dict) }}
ip-list = {{ dumps(apache_ip_list) }} ip-list = {{ dumps(apache_ip_list) }}
pid-file = ${directory:run}/apache.pid pid-file = ${directory:run}/apache.pid
...@@ -266,7 +266,7 @@ input = inline: ...@@ -266,7 +266,7 @@ input = inline:
module = check_port_listening module = check_port_listening
name = apache.py name = apache.py
config-hostname = {{ ipv4 }} config-hostname = {{ ipv4 }}
config-port = {{ apache_dict.values()[0][0] }} config-port = {{ list(apache_dict.values())[0][0] }}
[{{ section('publish') }}] [{{ section('publish') }}]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
...@@ -345,7 +345,7 @@ config-command = "{{ parameter_dict["check-computer-memory-binary"] }}" -db ${mo ...@@ -345,7 +345,7 @@ config-command = "{{ parameter_dict["check-computer-memory-binary"] }}" -db ${mo
[monitor-instance-parameter] [monitor-instance-parameter]
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ next_port() }} monitor-httpd-port = {{ next(ports) }}
monitor-title = {{ slapparameter_dict['name'] }} monitor-title = {{ slapparameter_dict['name'] }}
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%} {% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set partition_thread_count_list = [] -%} {% set partition_thread_count_list = [] -%}
{% set zope_partition_dict = slapparameter_dict.get('zope-partition-dict', {'1': {}}) -%} {% set zope_partition_dict = slapparameter_dict.get('zope-partition-dict', {'1': {}}) -%}
{% for zope_parameter_dict in zope_partition_dict.values() -%} {% for zope_parameter_dict in list(zope_partition_dict.values()) -%}
{# Apply some zope_parameter_dict default values, to avoid duplication. -#} {# Apply some zope_parameter_dict default values, to avoid duplication. -#}
{% do zope_parameter_dict.setdefault('thread-amount', 4) -%} {% do zope_parameter_dict.setdefault('thread-amount', 4) -%}
{% do zope_parameter_dict.setdefault('instance-count', 1) -%} {% do zope_parameter_dict.setdefault('instance-count', 1) -%}
...@@ -44,7 +44,7 @@ config-computer-memory-percent-threshold = {{ dumps(monitor_dict.get('computer-m ...@@ -44,7 +44,7 @@ config-computer-memory-percent-threshold = {{ dumps(monitor_dict.get('computer-m
name = {{ name }} name = {{ name }}
software-type = {{ software_type }} software-type = {{ software_type }}
return = {{ ' '.join(ret) }} return = {{ ' '.join(ret) }}
{% for ret, publish in ret.iteritems() -%} {% for ret, publish in six.iteritems(ret) -%}
{% if publish -%} {% if publish -%}
{% do publish_dict.__setitem__(name ~ '-' ~ ret, '${' ~ section ~ ':connection-' ~ ret ~ '}') %} {% do publish_dict.__setitem__(name ~ '-' ~ ret, '${' ~ section ~ ':connection-' ~ ret ~ '}') %}
{% endif -%} {% endif -%}
...@@ -53,10 +53,10 @@ return = {{ ' '.join(ret) }} ...@@ -53,10 +53,10 @@ return = {{ ' '.join(ret) }}
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
{{ root_common.sla(name) }} {{ root_common.sla(name) }}
{% for k, v in config.iteritems() -%} {% for k, v in six.iteritems(config) -%}
config-{{ k }} = {{ dumps(v) }} config-{{ k }} = {{ dumps(v) }}
{% endfor -%} {% endfor -%}
{% for k, v in key_config.iteritems() -%} {% for k, v in six.iteritems(key_config) -%}
config-{{ k }} = {{ '${' ~ v ~ '}' }} config-{{ k }} = {{ '${' ~ v ~ '}' }}
{% endfor -%} {% endfor -%}
config-name = {{ name }} config-name = {{ name }}
...@@ -146,7 +146,7 @@ connection-url = smtp://127.0.0.2:0/ ...@@ -146,7 +146,7 @@ connection-url = smtp://127.0.0.2:0/
{% endfor -%} {% endfor -%}
{% do assert(len(mountpoints) == len(zodb_dict)) -%} {% do assert(len(mountpoints) == len(zodb_dict)) -%}
{% set neo = [] -%} {% set neo = [] -%}
{% for server_type, server_dict in storage_dict.iteritems() -%} {% for server_type, server_dict in six.iteritems(storage_dict) -%}
{% if server_type == 'neo' -%} {% if server_type == 'neo' -%}
{% set ((name, server_dict),) = server_dict.items() -%} {% set ((name, server_dict),) = server_dict.items() -%}
{% do neo.append(server_dict.get('cluster')) -%} {% do neo.append(server_dict.get('cluster')) -%}
...@@ -208,10 +208,10 @@ config-wsgi = {{ dumps(slapparameter_dict.get('wsgi', True)) }} ...@@ -208,10 +208,10 @@ config-wsgi = {{ dumps(slapparameter_dict.get('wsgi', True)) }}
config-zodb-dict = {{ dumps(zodb_dict) }} config-zodb-dict = {{ dumps(zodb_dict) }}
config-test-runner-enabled = {{ dumps(test_runner_enabled) }} config-test-runner-enabled = {{ dumps(test_runner_enabled) }}
config-test-runner-node-count = {{ dumps(test_runner_node_count) }} config-test-runner-node-count = {{ dumps(test_runner_node_count) }}
{% for server_type, server_dict in storage_dict.iteritems() -%} {% for server_type, server_dict in six.iteritems(storage_dict) -%}
{% if server_type == 'neo' -%} {% if server_type == 'neo' -%}
config-neo-cluster = ${publish-early:neo-cluster} config-neo-cluster = ${publish-early:neo-cluster}
config-neo-name = {{ server_dict.keys()[0] }} config-neo-name = {{ list(server_dict)[0] }}
config-neo-masters = ${publish-early:neo-masters} config-neo-masters = ${publish-early:neo-masters}
{% else -%} {% else -%}
config-zodb-zeo = ${request-zodb:connection-storage-dict} config-zodb-zeo = ${request-zodb:connection-storage-dict}
...@@ -372,7 +372,7 @@ recipe = slapos.cookbook:publish.serialised ...@@ -372,7 +372,7 @@ recipe = slapos.cookbook:publish.serialised
Pick any published hosts-dict, they are expected to be identical - and there is Pick any published hosts-dict, they are expected to be identical - and there is
no way to check here. no way to check here.
-#} -#}
hosts-dict = {{ '${' ~ zope_address_list_id_dict.keys()[0] ~ ':connection-hosts-dict}' }} hosts-dict = {{ '${' ~ list(zope_address_list_id_dict)[0] ~ ':connection-hosts-dict}' }}
{% endif -%} {% endif -%}
{% for name, value in publish_dict.items() -%} {% for name, value in publish_dict.items() -%}
{{ name }} = {{ value }} {{ name }} = {{ value }}
......
...@@ -195,16 +195,17 @@ environ = ...@@ -195,16 +195,17 @@ environ =
{{ variable }} {{ variable }}
{%- endfor %} {%- endfor %}
[odbc-ini-text]
text = {{ dumps(slapparameter_dict.get('odbc-ini', '').encode('base64')) }}
[{{ section('odbc-ini') }}] [{{ section('odbc-ini') }}]
< = jinja2-template-base < = jinja2-template-base
rendered = ${directory:etc}/odbc.ini rendered = ${directory:etc}/odbc.ini
template = inline:{% raw -%} template = inline:{% raw -%}
{{ parameter_dict['text'].decode('base64') }} {{ base64.b64decode(text).decode('utf-8') }}
{%- endraw %} {%- endraw %}
context = section parameter_dict odbc-ini-text text = {{ dumps(base64.b64encode(slapparameter_dict.get('odbc-ini', '').encode('utf-8'))) }}
context =
key text :text
import base64 base64
[{{ section('logrotate-entry-mariadb') }}] [{{ section('logrotate-entry-mariadb') }}]
< = logrotate-entry-base < = logrotate-entry-base
......
{% set next_port = itertools.count(slapparameter_dict['tcpv4-port']).next -%} {% set ports = itertools.count(slapparameter_dict['tcpv4-port']) -%}
{% set ipv4 = (ipv4_set | list)[0] -%} {% set ipv4 = (ipv4_set | list)[0] -%}
{% set backup_periodicity = slapparameter_dict.get('backup-periodicity', 'daily') -%} {% set backup_periodicity = slapparameter_dict.get('backup-periodicity', 'daily') -%}
{% set part_list = [] -%} {% set part_list = [] -%}
...@@ -19,13 +19,13 @@ ip = {{ ipv4 }} ...@@ -19,13 +19,13 @@ ip = {{ ipv4 }}
{% set known_tid_storage_identifier_dict = {} -%} {% set known_tid_storage_identifier_dict = {} -%}
{% set zodb_dict = {} -%} {% set zodb_dict = {} -%}
{% for name, zodb in slapparameter_dict['zodb-dict'].iteritems() -%} {% for name, zodb in six.iteritems(slapparameter_dict['zodb-dict']) -%}
{% do zodb_dict.setdefault(zodb.get('family', 'default').lower(), []).append((name, zodb)) -%} {% do zodb_dict.setdefault(zodb.get('family', 'default').lower(), []).append((name, zodb)) -%}
{% endfor -%} {% endfor -%}
{% set tidstorage_port = slapparameter_dict['tcpv4-port'] + len(zodb_dict) -%} {% set tidstorage_port = slapparameter_dict['tcpv4-port'] + len(zodb_dict) -%}
{% for family, zodb in zodb_dict.iteritems() -%} {% for family, zodb in six.iteritems(zodb_dict) -%}
{% set storage_list = [] -%} {% set storage_list = [] -%}
{% set current_port = next_port() -%} {% set current_port = next(ports) -%}
{% set known_tid_storage_identifier_host = (ipv4, current_port), -%} {% set known_tid_storage_identifier_host = (ipv4, current_port), -%}
{% for name, zodb in zodb -%} {% for name, zodb in zodb -%}
{% do storage_dict.__setitem__(name, {'server': ipv4 ~ ':' ~ current_port, 'storage': name}) %} {% do storage_dict.__setitem__(name, {'server': ipv4 ~ ':' ~ current_port, 'storage': name}) %}
...@@ -140,7 +140,7 @@ input = inline: #!/bin/sh ...@@ -140,7 +140,7 @@ input = inline: #!/bin/sh
zodb_backup_directory="{{ default_backup_path }}" zodb_backup_directory="{{ default_backup_path }}"
repozo="${tidstorage:repozo-binary}" repozo="${tidstorage:repozo-binary}"
EXIT_CODE=0 EXIT_CODE=0
{% for family, zodb in zodb_dict.iteritems() -%} {% for family, zodb in six.iteritems(zodb_dict) -%}
{% for name, zodb in zodb -%} {% for name, zodb in zodb -%}
{% set zeo_section_name = 'zeo-' ~ family %} {% set zeo_section_name = 'zeo-' ~ family %}
storage_name="{{ name }}" storage_name="{{ name }}"
...@@ -209,7 +209,7 @@ tidstorage = {{ tidstorage_repozo_path }} ...@@ -209,7 +209,7 @@ tidstorage = {{ tidstorage_repozo_path }}
[monitor-instance-parameter] [monitor-instance-parameter]
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ next_port() }} monitor-httpd-port = {{ next(ports) }}
monitor-title = {{ slapparameter_dict['name'] }} monitor-title = {{ slapparameter_dict['name'] }}
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
......
{% set wsgi = slapparameter_dict['wsgi'] -%} {% set wsgi = slapparameter_dict['wsgi'] -%}
{% set webdav = slapparameter_dict['webdav'] -%} {% set webdav = slapparameter_dict['webdav'] -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%} {% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set next_port = itertools.count(slapparameter_dict['port-base']).next -%} {% set ports = itertools.count(slapparameter_dict['port-base']) -%}
{% set site_id = slapparameter_dict['site-id'] -%} {% set site_id = slapparameter_dict['site-id'] -%}
{% set zodb_dict = slapparameter_dict['zodb-dict'] -%} {% set zodb_dict = slapparameter_dict['zodb-dict'] -%}
{% set instance_index_list = range(slapparameter_dict['instance-count']) -%} {% set instance_index_list = range(slapparameter_dict['instance-count']) -%}
...@@ -30,14 +30,14 @@ partition. No more (undefined result), no less (IndexError). ...@@ -30,14 +30,14 @@ partition. No more (undefined result), no less (IndexError).
('erp5-cloudooo', slapparameter_dict['cloudooo-url']), ('erp5-cloudooo', slapparameter_dict['cloudooo-url']),
('erp5-smtp', slapparameter_dict['smtp-url']), ('erp5-smtp', slapparameter_dict['smtp-url']),
) -%} ) -%}
{% set parsed_url = urlparse.urlparse(url) -%} {% set parsed_url = urllib_parse.urlparse(url) -%}
{% do port_dict.__setitem__(alias, parsed_url.port) -%} {% do port_dict.__setitem__(alias, parsed_url.port) -%}
{% do hosts_dict.__setitem__(alias, parsed_url.hostname) -%} {% do hosts_dict.__setitem__(alias, parsed_url.hostname) -%}
{%- endfor %} {%- endfor %}
{% for i, url in enumerate(slapparameter_dict['mysql-url-list']) -%} {% for i, url in enumerate(slapparameter_dict['mysql-url-list']) -%}
{% do hosts_dict.__setitem__( {% do hosts_dict.__setitem__(
'erp5-catalog-' ~ i, 'erp5-catalog-' ~ i,
urlparse.urlparse(url).hostname, urllib_parse.urlparse(url).hostname,
) -%} ) -%}
{%- endfor %} {%- endfor %}
{% do hosts_dict.update(slapparameter_dict['hosts-dict']) -%} {% do hosts_dict.update(slapparameter_dict['hosts-dict']) -%}
...@@ -180,7 +180,7 @@ environment = ...@@ -180,7 +180,7 @@ environment =
command-line = '{{ parameter_dict['userhosts'] }}' ${:wrapped-command-line} command-line = '{{ parameter_dict['userhosts'] }}' ${:wrapped-command-line}
{# Hack to deploy SSL certs via instance parameters -#} {# Hack to deploy SSL certs via instance parameters -#}
{% for zodb in zodb_dict.itervalues() -%} {% for zodb in six.itervalues(zodb_dict) -%}
{% set storage_dict = zodb.setdefault('storage-dict', {}) -%} {% set storage_dict = zodb.setdefault('storage-dict', {}) -%}
{% if zodb['type'] == 'neo' and storage_dict.get('ssl', 1) -%} {% if zodb['type'] == 'neo' and storage_dict.get('ssl', 1) -%}
{% for k, v in (('_ca', 'ca.crt'), {% for k, v in (('_ca', 'ca.crt'),
...@@ -221,7 +221,7 @@ file-list = {{ parameter_dict['site-zcml'] }} ...@@ -221,7 +221,7 @@ file-list = {{ parameter_dict['site-zcml'] }}
[{{ section('zope-inituser') }}] [{{ section('zope-inituser') }}]
< = jinja2-template-base < = jinja2-template-base
rendered = ${directory:instance}/inituser rendered = ${directory:instance}/inituser
template = inline:{{ slapparameter_dict['inituser-login'] }}:{SHA}{{ hashlib.sha1(slapparameter_dict['inituser-password']).digest().encode('base64').rstrip() }} template = inline:{{ slapparameter_dict['inituser-login'] }}:{SHA}{{ base64.b64encode(hashlib.sha1(slapparameter_dict['inituser-password'].encode('utf-8')).digest()) }}
mode = 600 mode = 600
once = ${:rendered}_done once = ${:rendered}_done
...@@ -231,7 +231,7 @@ site-id = {{ site_id }} ...@@ -231,7 +231,7 @@ site-id = {{ site_id }}
{% if site_id -%} {% if site_id -%}
mysql-url = {{ slapparameter_dict['mysql-url-list'][0] }} mysql-url = {{ slapparameter_dict['mysql-url-list'][0] }}
inituser = {{ slapparameter_dict['inituser-login'] }} inituser = {{ slapparameter_dict['inituser-login'] }}
{% set mysql = urlparse.urlsplit(slapparameter_dict['mysql-url-list'][0]) -%} {% set mysql = urllib_parse.urlsplit(slapparameter_dict['mysql-url-list'][0]) -%}
{% set mysql_db = mysql.path.split('/')[1] -%} {% set mysql_db = mysql.path.split('/')[1] -%}
sql-connection-string = {{ '%s@erp5-catalog-0:%s %s %s' % ( sql-connection-string = {{ '%s@erp5-catalog-0:%s %s %s' % (
mysql_db, mysql.port, mysql.username, mysql.password) }} mysql_db, mysql.port, mysql.username, mysql.password) }}
...@@ -242,13 +242,13 @@ home = ${buildout:directory} ...@@ -242,13 +242,13 @@ home = ${buildout:directory}
# We only want to change the hostname to 'erp5-cloudooo' if we use the internal # We only want to change the hostname to 'erp5-cloudooo' if we use the internal
# cloudooo. We plan to remove the ability to have an internal one, so this # cloudooo. We plan to remove the ability to have an internal one, so this
# heuristic is enough. # heuristic is enough.
{% set cloudooo = urlparse.urlsplit(slapparameter_dict['cloudooo-url']) -%} {% set cloudooo = urllib_parse.urlsplit(slapparameter_dict['cloudooo-url']) -%}
cloudooo-url = {{ (cloudooo if cloudooo.port == None else cloudooo-url = {{ (cloudooo if cloudooo.port == None else
cloudooo._replace(netloc='erp5-cloudooo:%s' % cloudooo.port)).geturl() }} cloudooo._replace(netloc='erp5-cloudooo:%s' % cloudooo.port)).geturl() }}
{% endif -%} {% endif -%}
{% set zeo_dict = slapparameter_dict.get('zodb-zeo', {}) -%} {% set zeo_dict = slapparameter_dict.get('zodb-zeo', {}) -%}
{% for name, zodb in zodb_dict.iteritems() -%} {% for name, zodb in six.iteritems(zodb_dict) -%}
{% set storage_dict = zodb.setdefault('storage-dict', {}) -%} {% set storage_dict = zodb.setdefault('storage-dict', {}) -%}
{% if zodb['type'] == 'zeo' -%} {% if zodb['type'] == 'zeo' -%}
{% do storage_dict.update(zeo_dict.get(name, ())) -%} {% do storage_dict.update(zeo_dict.get(name, ())) -%}
...@@ -316,7 +316,7 @@ z2-log = ${directory:log}/{{ name }}-Z2.log ...@@ -316,7 +316,7 @@ z2-log = ${directory:log}/{{ name }}-Z2.log
node-id = {{ dumps(node_id_base ~ (node_id_index_format % index)) }} node-id = {{ dumps(node_id_base ~ (node_id_index_format % index)) }}
{% set log_list = [] -%} {% set log_list = [] -%}
{% set import_set = set() -%} {% set import_set = set() -%}
{% for db_name, zodb in zodb_dict.iteritems() -%} {% for db_name, zodb in six.iteritems(zodb_dict) -%}
{% do zodb.setdefault('pool-size', thread_amount) -%} {% do zodb.setdefault('pool-size', thread_amount) -%}
{% if zodb['type'] == 'neo' -%} {% if zodb['type'] == 'neo' -%}
{% do import_set.add('neo.client') -%} {% do import_set.add('neo.client') -%}
...@@ -410,7 +410,7 @@ post = test ! -s {{ '${' ~ conf_parameter_name ~ ':pid-file}' }} || {{ bin_direc ...@@ -410,7 +410,7 @@ post = test ! -s {{ '${' ~ conf_parameter_name ~ ':pid-file}' }} || {{ bin_direc
{% for i in instance_index_list -%} {% for i in instance_index_list -%}
{{ zope( {{ zope(
i, i,
next_port(), next(ports),
slapparameter_dict['longrequest-logger-timeout'], slapparameter_dict['longrequest-logger-timeout'],
slapparameter_dict['longrequest-logger-interval'], slapparameter_dict['longrequest-logger-interval'],
) }} ) }}
...@@ -428,7 +428,7 @@ wrapper-path = ${buildout:bin-directory}/${:_buildout_section_name_} ...@@ -428,7 +428,7 @@ wrapper-path = ${buildout:bin-directory}/${:_buildout_section_name_}
{% if test_runner_enabled and test_runner_node_count -%} {% if test_runner_enabled and test_runner_node_count -%}
{% for _ in range(test_runner_node_count) %} {% for _ in range(test_runner_node_count) %}
{% do test_runner_address_list.append((ipv4, next_port())) %} {% do test_runner_address_list.append((ipv4, next(ports))) %}
{% endfor %} {% endfor %}
{% if selenium_server_configuration_dict -%} {% if selenium_server_configuration_dict -%}
...@@ -462,7 +462,7 @@ wrapper-path = ${buildout:bin-directory}/runTestSuite ...@@ -462,7 +462,7 @@ wrapper-path = ${buildout:bin-directory}/runTestSuite
{% set connection_string_list = [] -%} {% set connection_string_list = [] -%}
{% for url in slapparameter_dict['mysql-test-url-list'] -%} {% for url in slapparameter_dict['mysql-test-url-list'] -%}
{% set parsed_url = urlparse.urlparse(url) -%} {% set parsed_url = urllib_parse.urlparse(url) -%}
{% do connection_string_list.append( {% do connection_string_list.append(
'%s@%s:%s %s %s' % ( '%s@%s:%s %s %s' % (
parsed_url.path.lstrip('/'), parsed_url.path.lstrip('/'),
...@@ -560,7 +560,7 @@ test-runner-address-list = {{ dumps(test_runner_address_list) }} ...@@ -560,7 +560,7 @@ test-runner-address-list = {{ dumps(test_runner_address_list) }}
[monitor-instance-parameter] [monitor-instance-parameter]
monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }} monitor-httpd-ipv6 = {{ (ipv6_set | list)[0] }}
monitor-httpd-port = {{ next_port() }} monitor-httpd-port = {{ next(ports) }}
monitor-title = {{ slapparameter_dict['name'] }} monitor-title = {{ slapparameter_dict['name'] }}
password = {{ slapparameter_dict['monitor-passwd'] }} password = {{ slapparameter_dict['monitor-passwd'] }}
......
...@@ -47,7 +47,7 @@ extra-context = ...@@ -47,7 +47,7 @@ extra-context =
key local_bt5_repository dynamic-template-erp5-parameters:local-bt5-repository key local_bt5_repository dynamic-template-erp5-parameters:local-bt5-repository
key openssl_location :openssl-location key openssl_location :openssl-location
import re re import re re
import urlparse urlparse import urllib_parse six.moves.urllib.parse
import-list = import-list =
file root_common context:root-common file root_common context:root-common
file caucase context:caucase-jinja2-library file caucase context:caucase-jinja2-library
...@@ -118,7 +118,8 @@ extra-context = ...@@ -118,7 +118,8 @@ extra-context =
key buildout_directory buildout:directory key buildout_directory buildout:directory
key root_common context:root-common key root_common context:root-common
section parameter_dict dynamic-template-zope-parameters section parameter_dict dynamic-template-zope-parameters
import urlparse urlparse import base64 base64
import urllib_parse six.moves.urllib.parse
import hashlib hashlib import hashlib hashlib
import itertools itertools import itertools itertools
...@@ -165,6 +166,7 @@ template = {{ template_mariadb }} ...@@ -165,6 +166,7 @@ template = {{ template_mariadb }}
filename = instance-mariadb.cfg filename = instance-mariadb.cfg
extra-context = extra-context =
section parameter_dict dynamic-template-mariadb-parameters section parameter_dict dynamic-template-mariadb-parameters
import base64 base64
# Keep a section for backward compatibility for removed types # Keep a section for backward compatibility for removed types
# Once the section is removed, ghost instances will keep failing until # Once the section is removed, ghost instances will keep failing until
......
...@@ -181,7 +181,7 @@ def main(): ...@@ -181,7 +181,7 @@ def main():
try: try:
test_result = tool.createTestResult(revision = revision, test_result = tool.createTestResult(revision = revision,
test_name_list = test_line_dict.keys(), test_name_list = list(test_line_dict),
node_title = args.test_node_title, node_title = args.test_node_title,
test_title = test_suite_title, test_title = test_suite_title,
project_title = args.project_title) project_title = args.project_title)
......
...@@ -151,17 +151,17 @@ large-file-threshold {{ parameter_dict['large-file-threshold'] }} ...@@ -151,17 +151,17 @@ large-file-threshold {{ parameter_dict['large-file-threshold'] }}
%import {{ m }} %import {{ m }}
{% endfor -%} {% endfor -%}
{% set type_dict = {'neo': 'NEOStorage', 'zeo': 'zeoclient'} %} {% set type_dict = {'neo': 'NEOStorage', 'zeo': 'zeoclient'} %}
{% for name, zodb_dict in parameter_dict['zodb-dict'].iteritems() %} {% for name, zodb_dict in six.iteritems(parameter_dict['zodb-dict']) %}
<zodb_db {{ name }}> <zodb_db {{ name }}>
{%- set storage_type = type_dict[zodb_dict.pop('type')] %} {%- set storage_type = type_dict[zodb_dict.pop('type')] %}
{%- set storage_dict = zodb_dict.pop('storage-dict') %} {%- set storage_dict = zodb_dict.pop('storage-dict') %}
{%- do root_common.apply_overrides(zodb_dict, node_id) %} {%- do root_common.apply_overrides(zodb_dict, node_id) %}
{%- for key, value in zodb_dict.iteritems() %} {%- for key, value in six.iteritems(zodb_dict) %}
{{ key }} {{ value }} {{ key }} {{ value }}
{%- endfor %} {%- endfor %}
<{{ storage_type }}> <{{ storage_type }}>
{%- do root_common.apply_overrides(storage_dict, node_id) %} {%- do root_common.apply_overrides(storage_dict, node_id) %}
{%- for key, value in storage_dict.iteritems() %} {%- for key, value in six.iteritems(storage_dict) %}
{{ key }} {{ value }} {{ key }} {{ value }}
{%- endfor %} {%- endfor %}
</{{ storage_type }}> </{{ storage_type }}>
......
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