Commit fc0a63c6 authored by Vincent Pelletier's avatar Vincent Pelletier

stack/erp5: Add experimental per-computer hosts overrides.

Use-case: when an host enry is used to define the outgoing binding IP of
zopes in a partition, this IP is host-dependent.
parent 31db0b32
Pipeline #14042 failed with stage
in 0 seconds
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# not need these here). # not need these here).
[instance-common] [instance-common]
filename = instance-common.cfg.in filename = instance-common.cfg.in
md5sum = 6da513940e5bf7d06b3fb0aeb39c8ad5 md5sum = 2bd1779425b7561682c0de5496d808ed
[root-common] [root-common]
filename = root-common.cfg.in filename = root-common.cfg.in
......
...@@ -23,6 +23,7 @@ context = ...@@ -23,6 +23,7 @@ context =
key ipv4_set slap-configuration:ipv4 key ipv4_set slap-configuration:ipv4
key ipv6_set slap-configuration:ipv6 key ipv6_set slap-configuration:ipv6
key slapparameter_dict slap-configuration:configuration key slapparameter_dict slap-configuration:configuration
key computer slap-configuration:computer
raw logrotate_cfg {{ template_logrotate_base }} raw logrotate_cfg {{ template_logrotate_base }}
raw template_monitor {{ template_monitor }} raw template_monitor {{ template_monitor }}
raw bin_directory {{ bin_directory }} raw bin_directory {{ bin_directory }}
......
...@@ -74,7 +74,7 @@ md5sum = b5ac16fdeed8863e465e955ba6d1e12a ...@@ -74,7 +74,7 @@ md5sum = b5ac16fdeed8863e465e955ba6d1e12a
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = 068f2590a8ad4db1ad2f16eeb29986cf md5sum = 852cad92ad2ec3d5dbd2f94efae2b401
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
...@@ -82,7 +82,7 @@ md5sum = 0648e38bd5d3a15bb9f93264932740b9 ...@@ -82,7 +82,7 @@ md5sum = 0648e38bd5d3a15bb9f93264932740b9
[template-zope] [template-zope]
filename = instance-zope.cfg.in filename = instance-zope.cfg.in
md5sum = e31bbec1580d67ba84563b1d59c386b8 md5sum = 98b3032baaaf424527be0b106d1f48e6
[template-balancer] [template-balancer]
filename = instance-balancer.cfg.in filename = instance-balancer.cfg.in
......
...@@ -220,6 +220,7 @@ config-deadlock-debugger-password = ${publish-early:deadlock-debugger-password} ...@@ -220,6 +220,7 @@ config-deadlock-debugger-password = ${publish-early:deadlock-debugger-password}
config-developer-list = {{ dumps(slapparameter_dict.get('developer-list', [inituser_login])) }} config-developer-list = {{ dumps(slapparameter_dict.get('developer-list', [inituser_login])) }}
config-selenium-server-configuration-dict = {{ dumps(slapparameter_dict.get('selenium-server-configuration-dict', {})) }} config-selenium-server-configuration-dict = {{ dumps(slapparameter_dict.get('selenium-server-configuration-dict', {})) }}
config-hosts-dict = {{ dumps(slapparameter_dict.get('hosts-dict', {})) }} config-hosts-dict = {{ dumps(slapparameter_dict.get('hosts-dict', {})) }}
config-computer-hosts-dict = {{ dumps(slapparameter_dict.get('computer-hosts-dict', {})) }}
config-hostalias-dict = {{ dumps(slapparameter_dict.get('hostalias-dict', {})) }} config-hostalias-dict = {{ dumps(slapparameter_dict.get('hostalias-dict', {})) }}
config-id-store-interval = {{ dumps(slapparameter_dict.get('id-store-interval')) }} config-id-store-interval = {{ dumps(slapparameter_dict.get('id-store-interval')) }}
config-zope-longrequest-logger-error-threshold = {{ dumps(monitor_dict.get('zope-longrequest-logger-error-threshold', 20)) }} config-zope-longrequest-logger-error-threshold = {{ dumps(monitor_dict.get('zope-longrequest-logger-error-threshold', 20)) }}
......
...@@ -22,7 +22,7 @@ partition. No more (undefined result), no less (IndexError). ...@@ -22,7 +22,7 @@ partition. No more (undefined result), no less (IndexError).
-#} -#}
{% set ipv4 = (ipv4_set | list)[0] -%} {% set ipv4 = (ipv4_set | list)[0] -%}
{% set hosts_dict = {} -%} {% set publishable_hosts_dict = {} -%}
{% set port_dict = {} -%} {% set port_dict = {} -%}
{% for alias, url in ( {% for alias, url in (
('erp5-memcached-volatile', slapparameter_dict['memcached-url']), ('erp5-memcached-volatile', slapparameter_dict['memcached-url']),
...@@ -32,15 +32,17 @@ partition. No more (undefined result), no less (IndexError). ...@@ -32,15 +32,17 @@ partition. No more (undefined result), no less (IndexError).
) -%} ) -%}
{% set parsed_url = urlparse.urlparse(url) -%} {% set parsed_url = urlparse.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 publishable_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 publishable_hosts_dict.__setitem__(
'erp5-catalog-' ~ i, 'erp5-catalog-' ~ i,
urlparse.urlparse(url).hostname, urlparse.urlparse(url).hostname,
) -%} ) -%}
{%- endfor %} {%- endfor %}
{% do hosts_dict.update(slapparameter_dict['hosts-dict']) -%} {% do publishable_hosts_dict.update(slapparameter_dict['hosts-dict']) -%}
{% set hosts_dict = publishable_hosts_dict.copy() -%}
{% do hosts_dict.update(slapparameter_dict['computer-hosts-dict'].get(computer, {})) -%}
[jinja2-template-base] [jinja2-template-base]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
...@@ -555,7 +557,7 @@ This has the downside of making each zope partition publish the (hopefuly) same ...@@ -555,7 +557,7 @@ This has the downside of making each zope partition publish the (hopefuly) same
dict toward erp5 partition, violating the DRY principle and making the intent dict toward erp5 partition, violating the DRY principle and making the intent
hard to guess. hard to guess.
-#} -#}
hosts-dict = {{ dumps(hosts_dict) }} hosts-dict = {{ dumps(publishable_hosts_dict) }}
monitor-base-url = ${monitor-publish-parameters:monitor-base-url} monitor-base-url = ${monitor-publish-parameters:monitor-base-url}
test-runner-address-list = {{ dumps(test_runner_address_list) }} test-runner-address-list = {{ dumps(test_runner_address_list) }}
software-release-url = ${slap-connection:software-release-url} software-release-url = ${slap-connection:software-release-url}
......
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