Commit 601b8d67 authored by Xavier Thompson's avatar Xavier Thompson Committed by Jérome Perrin

software/theia: Make theiaN frontend names unique

This concerns a case of resiliency in Theia: when a resilient Theia
requests multiple import clones (by default only one is requested),
e.g. when theia0 (export) has two import clones theia1 and theia2.

Each clone requests a frontend for their theia service, which allows
the Theia editor of the clone to be accessed without doing a takeover.

Before this, all the import clones would request a frontend with the
same name. This meant that only one frontend was allocated and might
randomly redirect to one of the backup clones.

See merge request nexedi/slapos!1481
parent efd88387
...@@ -23,7 +23,7 @@ md5sum = 9658a11340c018de816d0de40683706a ...@@ -23,7 +23,7 @@ md5sum = 9658a11340c018de816d0de40683706a
[instance-import] [instance-import]
_update_hash_filename_ = instance-import.cfg.jinja.in _update_hash_filename_ = instance-import.cfg.jinja.in
md5sum = 6520d2aa0c1c6094cbf276080594ec1a md5sum = c8d1be7aee980deb0f0d1a3126c9b9da
[instance-export] [instance-export]
_update_hash_filename_ = instance-export.cfg.jinja.in _update_hash_filename_ = instance-export.cfg.jinja.in
......
{%- set parameter_dict = dict(default_parameter_dict, **parameter_dict) -%} {%- set parameter_dict = dict(default_parameter_dict, **parameter_dict) -%}
{%- set additional_frontend = parameter_dict['additional-frontend-guid'] -%} {%- set additional_frontend = parameter_dict['additional-frontend-guid'] -%}
{%- set namebase = parameter_dict['namebase'] -%}
{%- set theia_number = parameter_dict['number'] -%}
{%- set theia_id = '%s%s' % (namebase, theia_number) -%}
{%- set frontend_name = parameter_dict['frontend-name'] -%}
[buildout] [buildout]
extends = {{ theia_instance_cfg }} extends = {{ theia_instance_cfg }}
...@@ -16,16 +20,16 @@ parts += ...@@ -16,16 +20,16 @@ parts +=
# The import template then expects to receive it in # The import template then expects to receive it in
# slap-parameter:namebase # slap-parameter:namebase
[slap-parameter] [slap-parameter]
namebase = {{ parameter_dict['namebase'] }} namebase = {{ namebase }}
# Change frontend name to avoid conflicts # Change frontend name to avoid conflicts
[remote-frontend] [remote-frontend]
name = Import {{ parameter_dict['frontend-name'] }} name = {{ frontend_name }} for {{ theia_id }}
{% if additional_frontend -%} {% if additional_frontend -%}
[remote-additional-frontend] [remote-additional-frontend]
name = Import {{ parameter_dict['additional-frontend-name'] }} name = {{ parameter_dict['additional-frontend-name'] }} for {{ theia-id }}
{%- endif %} {%- endif %}
......
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