Commit a38efbef authored by Xavier Thompson's avatar Xavier Thompson

stack/erp5: Fix ipv6 url of mariadb catalog

When use-ipv6 is enabled, make mariadb publish an url of the form:
  `mysql://user:password@[ipv6]:port/database`

instead of:
  `mysql://user:password@ipv6:port/database`

which results in the zope instances crashing during processing
due to urlparse.urlsplit failing to parse the url.
parent 6a4868db
...@@ -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 = 93b2277185e4949a3d17be79d3710d2d md5sum = e22baff0637d2973585dff2561487be5
[template-kumofs] [template-kumofs]
filename = instance-kumofs.cfg.in filename = instance-kumofs.cfg.in
......
...@@ -13,8 +13,10 @@ ...@@ -13,8 +13,10 @@
{% set port = slapparameter_dict['tcpv4-port'] %} {% set port = slapparameter_dict['tcpv4-port'] %}
{% if use_ipv6 -%} {% if use_ipv6 -%}
{% set ip = (ipv6_set | list)[0] -%} {% set ip = (ipv6_set | list)[0] -%}
{% set ip_as_host = '[%s]' % ip -%}
{% else -%} {% else -%}
{% set ip = (ipv4_set | list)[0] -%} {% set ip = (ipv4_set | list)[0] -%}
{% set ip_as_host = ip -%}
{% endif -%} {% endif -%}
{% set dash = parameter_dict['dash-location'] ~ '/bin/dash' %} {% set dash = parameter_dict['dash-location'] ~ '/bin/dash' %}
...@@ -25,9 +27,9 @@ recipe = slapos.cookbook:publish.serialised ...@@ -25,9 +27,9 @@ recipe = slapos.cookbook:publish.serialised
{% set publish_database_list = [] -%} {% set publish_database_list = [] -%}
{% for database in database_list -%} {% for database in database_list -%}
{% if database.get('user') -%} {% if database.get('user') -%}
{% do publish_database_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@" ~ ip ~ ":" ~ port ~ "/" ~ database['name']) -%} {% do publish_database_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@" ~ ip_as_host ~ ":" ~ port ~ "/" ~ database['name']) -%}
{% else -%} {% else -%}
{% do publish_database_list.append("mysql://" ~ ip ~ ":" ~ port ~ "/" ~ database['name']) -%} {% do publish_database_list.append("mysql://" ~ ip_as_host ~ ":" ~ port ~ "/" ~ database['name']) -%}
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
{{ dumps(publish_database_list) }} {{ dumps(publish_database_list) }}
......
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