Commit edcf83eb authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Reuse passed parameter_dict from instance.cfg.in

There is needless duplication of information.
parent 5e720d5b
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# not need these here). # not need these here).
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = 759be07fcebb20f855caf40750fbb59a md5sum = 4ee9654b01dd99e36ed84ddb08814309
[profile-common] [profile-common]
filename = instance-common.cfg.in filename = instance-common.cfg.in
...@@ -22,11 +22,11 @@ md5sum = 5784bea3bd608913769ff9a8afcccb68 ...@@ -22,11 +22,11 @@ md5sum = 5784bea3bd608913769ff9a8afcccb68
[profile-caddy-frontend] [profile-caddy-frontend]
filename = instance-apache-frontend.cfg.in filename = instance-apache-frontend.cfg.in
md5sum = ce1051040869f3040015e76c9a0085db md5sum = 3f0b109d039ca79d6a50ae32028c727c
[profile-caddy-replicate] [profile-caddy-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
md5sum = edda797f5bbc4533927bc4e9c9e21333 md5sum = 74beef8d78df18e7fe9d5a6a3a9bf43c
[profile-slave-list] [profile-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in _update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
...@@ -114,7 +114,7 @@ md5sum = 38792c2dceae38ab411592ec36fff6a8 ...@@ -114,7 +114,7 @@ md5sum = 38792c2dceae38ab411592ec36fff6a8
[profile-kedifa] [profile-kedifa]
filename = instance-kedifa.cfg.in filename = instance-kedifa.cfg.in
md5sum = 6aeb6a157605b20a8a81cf7b1590ff7c md5sum = b5165126e373a488fa514a724d3b1d70
[template-backend-haproxy-rsyslogd-conf] [template-backend-haproxy-rsyslogd-conf]
_update_hash_filename_ = templates/backend-haproxy-rsyslogd.conf.in _update_hash_filename_ = templates/backend-haproxy-rsyslogd.conf.in
......
{%- if slap_software_type == software_type -%} {%- if instance_parameter['slap-software-type'] == software_type -%}
{% import "caucase" as caucase with context %} {% import "caucase" as caucase with context %}
{%- set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%} {%- set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%}
[buildout] [buildout]
...@@ -1036,4 +1036,4 @@ config-command = ...@@ -1036,4 +1036,4 @@ config-command =
{{ key.replace('configuration.', '') }} = {{ dumps(value) }} {{ key.replace('configuration.', '') }} = {{ dumps(value) }}
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
{%- endif -%} {# if slap_software_type == software_type #} {%- endif -%} {# if instance_parameter['slap-software-type'] == software_type #}
{% if slap_software_type in software_type %} {% if instance_parameter['slap-software-type'] in software_type %}
{% set aibcc_enabled = True %} {% set aibcc_enabled = True %}
{% import "caucase" as caucase with context %} {% import "caucase" as caucase with context %}
{#- SERVER_POLLUTED_KEY_LIST is a list of keys which comes from various SlapOS Master implementations, which mix request and publish keys on each slave information -#} {#- SERVER_POLLUTED_KEY_LIST is a list of keys which comes from various SlapOS Master implementations, which mix request and publish keys on each slave information -#}
...@@ -20,18 +20,18 @@ rendered = ${buildout:directory}/${:filename} ...@@ -20,18 +20,18 @@ rendered = ${buildout:directory}/${:filename}
extra-context = extra-context =
context = context =
import json_module json import json_module json
raw profile_common {{ profile_common }} raw profile_common {{ parameter_dict['profile_common'] }}
${:extra-context} ${:extra-context}
{% set popen = functools_module.partial(subprocess_module.Popen, stdout=subprocess_module.PIPE, stderr=subprocess_module.STDOUT, stdin=subprocess_module.PIPE) %} {% set popen = functools_module.partial(subprocess_module.Popen, stdout=subprocess_module.PIPE, stderr=subprocess_module.STDOUT, stdin=subprocess_module.PIPE) %}
{% set part_list = [] %} {% set part_list = [] %}
{% set single_type_key = 'single-' %} {% set single_type_key = 'single-' %}
{% if slap_software_type == "replicate" %} {% if instance_parameter['slap-software-type'] == "replicate" %}
{% set frontend_type = slapparameter_dict.pop('-frontend-type', 'single-default') %} {% set frontend_type = slapparameter_dict.pop('-frontend-type', 'single-default') %}
{% elif slap_software_type in ['default', 'RootSoftwareInstance'] %} {% elif instance_parameter['slap-software-type'] in ['default', 'RootSoftwareInstance'] %}
{% set frontend_type = "%s%s" % (single_type_key, 'custom-personal') %} {% set frontend_type = "%s%s" % (single_type_key, 'custom-personal') %}
{% else %} {% else %}
{% set frontend_type = "%s%s" % (single_type_key, slap_software_type) %} {% set frontend_type = "%s%s" % (single_type_key, instance_parameter['slap-software-type']) %}
{% endif %} {% endif %}
{% set frontend_quantity = slapparameter_dict.pop('-frontend-quantity', '1') | int %} {% set frontend_quantity = slapparameter_dict.pop('-frontend-quantity', '1') | int %}
{% set slave_list_name = 'extra_slave_instance_list' %} {% set slave_list_name = 'extra_slave_instance_list' %}
...@@ -142,7 +142,7 @@ context = ...@@ -142,7 +142,7 @@ context =
{% for url_key in ['url', 'https-url'] %} {% for url_key in ['url', 'https-url'] %}
{% if url_key in slave %} {% if url_key in slave %}
{% set url = (slave[url_key] or '').strip() %} {% set url = (slave[url_key] or '').strip() %}
{% if subprocess_module.call([caddy_backend_url_validator, url]) == 1 or not validators.url(url) %} {% if subprocess_module.call([parameter_dict['caddy_backend_url_validator'], url]) == 1 or not validators.url(url) %}
{% do slave_error_list.append('slave %s %r invalid' % (url_key, url)) %} {% do slave_error_list.append('slave %s %r invalid' % (url_key, url)) %}
{% elif url != slave[url_key] %} {% elif url != slave[url_key] %}
{% do slave_warning_list.append('slave %s %r has been converted to %r' % (url_key, slave[url_key], url)) %} {% do slave_warning_list.append('slave %s %r has been converted to %r' % (url_key, slave[url_key], url)) %}
...@@ -375,7 +375,7 @@ active-slave-instance-list = {{ json_module.dumps(active_slave_instance_list, so ...@@ -375,7 +375,7 @@ active-slave-instance-list = {{ json_module.dumps(active_slave_instance_list, so
[dynamic-publish-slave-information] [dynamic-publish-slave-information]
< = jinja2-template-base < = jinja2-template-base
template = {{ template_publish_slave_information }} template = {{ parameter_dict['profile_replicate_publish_slave_information'] }}
filename = dynamic-publish-slave-information.cfg filename = dynamic-publish-slave-information.cfg
extensions = jinja2.ext.do extensions = jinja2.ext.do
extra-context = extra-context =
...@@ -773,8 +773,8 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg ...@@ -773,8 +773,8 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
[buildout] [buildout]
extends = extends =
{{ profile_common }} {{ parameter_dict['profile_common'] }}
{{ profile_monitor2 }} {{ parameter_dict['profile_monitor2'] }}
parts = parts =
monitor-base monitor-base
publish-slave-information publish-slave-information
......
{%- if slap_software_type == software_type -%} {%- if instance_parameter['slap-software-type'] == software_type -%}
{% import "caucase" as caucase with context %} {% import "caucase" as caucase with context %}
# KeDiFa instance profile # KeDiFa instance profile
[buildout] [buildout]
...@@ -311,4 +311,4 @@ name = ${:_buildout_section_name_}.py ...@@ -311,4 +311,4 @@ name = ${:_buildout_section_name_}.py
config-command = config-command =
${logrotate:wrapper-path} -d ${logrotate:wrapper-path} -d
{%- endif -%} {# if slap_software_type in software_type #} {%- endif -%} {# if instance_parameter['slap-software-type'] == software_type #}
...@@ -13,7 +13,6 @@ rendered = ${buildout:directory}/${:filename} ...@@ -13,7 +13,6 @@ rendered = ${buildout:directory}/${:filename}
extra-context = extra-context =
context = context =
import json_module json import json_module json
key slap_software_type instance-parameter:slap-software-type
key slapparameter_dict instance-parameter:configuration key slapparameter_dict instance-parameter:configuration
key slave_instance_list instance-parameter:slave-instance-list key slave_instance_list instance-parameter:slave-instance-list
section instance_parameter instance-parameter section instance_parameter instance-parameter
...@@ -58,12 +57,8 @@ extra-context = ...@@ -58,12 +57,8 @@ extra-context =
import functools_module functools import functools_module functools
import validators validators import validators validators
key cluster_identification instance-parameter:root-instance-title key cluster_identification instance-parameter:root-instance-title
raw caddy_backend_url_validator {{ template_frontend_parameter_dict['caddy_backend_url_validator'] }}
raw template_publish_slave_information {{ template_frontend_parameter_dict['profile_replicate_publish_slave_information'] }}
# Must match the key id in [switch-softwaretype] which uses this section. # Must match the key id in [switch-softwaretype] which uses this section.
raw software_type RootSoftwareInstance-default-custom-personal-replicate raw software_type RootSoftwareInstance-default-custom-personal-replicate
raw profile_monitor2 {{ template_frontend_parameter_dict['profile_monitor2'] }}
raw profile_common {{ template_frontend_parameter_dict['profile_common'] }}
caucase-jinja2-library = {{ template_frontend_parameter_dict['caucase_jinja2_library'] }} caucase-jinja2-library = {{ template_frontend_parameter_dict['caucase_jinja2_library'] }}
import-list = import-list =
file caucase :caucase-jinja2-library file caucase :caucase-jinja2-library
......
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