Commit 206f9717 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

caddy-frontend: Stabilise json dumps

Sorting will make dumped data "canonical", so it will limit amount of order
based changes.
parent 67447e28
......@@ -26,11 +26,11 @@ md5sum = 2903758a104186b7dae9573c3470be78
[template-caddy-replicate]
filename = instance-apache-replicate.cfg.in
md5sum = 89a7488419875c117b8eddd185a2d50b
md5sum = f874519f5c000d0c479dde34e1cbb268
[template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in
md5sum = c33df53e7752f43b89c5fda7e92a5a78
md5sum = d2afd6ef52754b14ba9bf881b9f685c6
[template-slave-configuration]
filename = templates/custom-virtualhost.conf.in
......@@ -38,7 +38,7 @@ md5sum = 54ae95597a126ae552c3a913ddf29e5e
[template-replicate-publish-slave-information]
filename = templates/replicate-publish-slave-information.cfg.in
md5sum = eb9ca67763d60843483d95dab2c301b1
md5sum = 7e3ee70c447f8203273d78f66ab519c3
[template-caddy-frontend-configuration]
filename = templates/Caddyfile.in
......@@ -118,4 +118,4 @@ md5sum = 38792c2dceae38ab411592ec36fff6a8
[template-kedifa]
filename = instance-kedifa.cfg.in
md5sum = 2136723657cb10bafea4fe6bff7b6481
md5sum = cff26f5f85bb6fe6099150851e3874c7
......@@ -236,7 +236,8 @@ config-cluster-identification = {{ cluster_identification }}
{% if state != 'destroyed' %}
{% set slave_configuration_dict = slapparameter_dict %}
{% do slave_configuration_dict.update(frontend_request.get('config')) %}
{% do slave_configuration_dict.__setitem__(slave_list_name, json_module.dumps(authorized_slave_list)) %}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
{% do slave_configuration_dict.__setitem__(slave_list_name, json_module.dumps(authorized_slave_list, sort_keys=True)) %}
{% do slave_configuration_dict.__setitem__("frontend-name", frontend_request.get('name')) %}
{%- for config_key, config_value in slave_configuration_dict.iteritems() %}
config-{{ config_key }} = {{ dumps(config_value) }}
......@@ -263,16 +264,19 @@ domain = {{ slapparameter_dict.get('domain') }}
slave-amount = {{ slave_instance_list | length }}
accepted-slave-amount = {{ authorized_slave_list | length }}
rejected-slave-amount = {{ rejected_slave_dict | length }}
rejected-slave-dict = {{ dumps(json_module.dumps(rejected_slave_title_dict)) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
rejected-slave-dict = {{ dumps(json_module.dumps(rejected_slave_title_dict, sort_keys=True)) }}
rejected-slave-promise-url = ${rejected-slave-promise:config-url}
master-key-upload-url = ${request-kedifa:connection-master-key-upload-url}
master-key-generate-auth-url = ${request-kedifa:connection-master-key-generate-auth-url}
kedifa-caucase-url = ${request-kedifa:connection-caucase-url}
{% if len(warning_list) > 0 %}
warning-list = {{ dumps(json_module.dumps(warning_list)) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
warning-list = {{ dumps(json_module.dumps(warning_list, sort_keys=True)) }}
{% endif %}
{% if len(warning_slave_dict) > 0 %}
warning-slave-dict = {{ dumps(json_module.dumps(warning_slave_dict)) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
warning-slave-dict = {{ dumps(json_module.dumps(warning_slave_dict, sort_keys=True)) }}
{% endif %}
{% if not aikc_enabled %}
kedifa-csr_id-url = ${request-kedifa:connection-csr_id-url}
......@@ -328,12 +332,14 @@ sla-{{ key[sla_kedifa_key_length:] }} = {{ slapparameter_dict.pop(key) }}
[rejected-slave-information]
{% for slave_id, rejected_list in rejected_slave_dict.iteritems() %}
{{ slave_id }} = {{ dumps(json_module.dumps(rejected_list)) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
{{ slave_id }} = {{ dumps(json_module.dumps(rejected_list, sort_keys=True)) }}
{% endfor %}
[warning-slave-information]
{% for slave_id, warning_list in warning_slave_dict.iteritems() %}
{{ slave_id }} = {{ dumps(json_module.dumps(warning_list)) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
{{ slave_id }} = {{ dumps(json_module.dumps(warning_list, sort_keys=True)) }}
{% endfor %}
[slave-information]
......@@ -348,7 +354,8 @@ sla-{{ key[sla_kedifa_key_length:] }} = {{ slapparameter_dict.pop(key) }}
{# Note: This functionality is not yet covered by tests, please modify with care #}
{% do active_slave_instance_list.append(slave_instance['slave_reference']) %}
{% endfor %}
active-slave-instance-list = {{ json_module.dumps(active_slave_instance_list) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
active-slave-instance-list = {{ json_module.dumps(active_slave_instance_list, sort_keys=True) }}
[dynamic-publish-slave-information]
< = jinja2-template-base
......@@ -496,7 +503,8 @@ directory = ${directory:promise-output}
rendered = ${:directory}/${:filename}
template = {{ parameter_dict['template_empty'] }}
{% if rejected_slave_title_dict %}
content = {{ dumps(json_module.dumps(rejected_slave_title_dict, indent=2)) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
content = {{ dumps(json_module.dumps(rejected_slave_title_dict, indent=2, sort_keys=True)) }}
{% else %}
content =
{% endif %}
......
......@@ -292,7 +292,8 @@ commands =
[slave-kedifa-information]
recipe = slapos.cookbook:publish.serialised
slave-kedifa-information = {{ json_module.dumps(slave_kedifa_information) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
slave-kedifa-information = {{ json_module.dumps(slave_kedifa_information, sort_keys=True) }}
caucase-url = {{ caucase_url }}
master-key-generate-auth-url = https://[${kedifa-config:ip}]:${kedifa-config:port}/${master-auth-random:passwd}/generateauth
master-key-upload-url = https://[${kedifa-config:ip}]:${kedifa-config:port}/${master-auth-random:passwd}?auth=
......
......@@ -446,7 +446,8 @@ recipe = slapos.cookbook:publish.serialised
public-ipv4 = {{ public_ipv4 }}
private-ipv4 = {{ local_ipv4 }}
{% if extra_slave_instance_list %}
slave-instance-information-list = {{ json_module.dumps(slave_instance_information_list) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
slave-instance-information-list = {{ json_module.dumps(slave_instance_information_list, sort_keys=True) }}
{% endif %}
monitor-base-url = {{ monitor_base_url }}
csr_id-url = https://[${expose-csr_id-configuration:ip}]:${expose-csr_id-configuration:port}/csr_id.txt
......
......@@ -65,7 +65,8 @@ recipe = slapos.cookbook:publish
-slave-reference = {{ slave_reference }}
{% set log_access_url = slave_information.pop('log-access-urls', None) %}
{% if log_access_url %}
log-access-url = {{ dumps(json_module.dumps(log_access_url)) }}
{# sort_keys are important in order to avoid shuffling parameters on each run #}
log-access-url = {{ dumps(json_module.dumps(log_access_url, sort_keys=True)) }}
{% endif %}
{% for key, value in slave_information.iteritems() %}
{{ key }} = {{ dumps(value) }}
......
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