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 @@
# not need these here).
[template]
filename = instance.cfg.in
md5sum = 759be07fcebb20f855caf40750fbb59a
md5sum = 4ee9654b01dd99e36ed84ddb08814309
[profile-common]
filename = instance-common.cfg.in
......@@ -22,11 +22,11 @@ md5sum = 5784bea3bd608913769ff9a8afcccb68
[profile-caddy-frontend]
filename = instance-apache-frontend.cfg.in
md5sum = ce1051040869f3040015e76c9a0085db
md5sum = 3f0b109d039ca79d6a50ae32028c727c
[profile-caddy-replicate]
filename = instance-apache-replicate.cfg.in
md5sum = edda797f5bbc4533927bc4e9c9e21333
md5sum = 74beef8d78df18e7fe9d5a6a3a9bf43c
[profile-slave-list]
_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in
......@@ -114,7 +114,7 @@ md5sum = 38792c2dceae38ab411592ec36fff6a8
[profile-kedifa]
filename = instance-kedifa.cfg.in
md5sum = 6aeb6a157605b20a8a81cf7b1590ff7c
md5sum = b5165126e373a488fa514a724d3b1d70
[template-backend-haproxy-rsyslogd-conf]
_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 %}
{%- set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%}
[buildout]
......@@ -1036,4 +1036,4 @@ config-command =
{{ key.replace('configuration.', '') }} = {{ dumps(value) }}
{%- endif -%}
{%- 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 %}
{% 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 -#}
......@@ -20,18 +20,18 @@ rendered = ${buildout:directory}/${:filename}
extra-context =
context =
import json_module json
raw profile_common {{ profile_common }}
raw profile_common {{ parameter_dict['profile_common'] }}
${:extra-context}
{% set popen = functools_module.partial(subprocess_module.Popen, stdout=subprocess_module.PIPE, stderr=subprocess_module.STDOUT, stdin=subprocess_module.PIPE) %}
{% set part_list = [] %}
{% 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') %}
{% 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') %}
{% 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 %}
{% set frontend_quantity = slapparameter_dict.pop('-frontend-quantity', '1') | int %}
{% set slave_list_name = 'extra_slave_instance_list' %}
......@@ -142,7 +142,7 @@ context =
{% for url_key in ['url', 'https-url'] %}
{% if url_key in slave %}
{% 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)) %}
{% elif url != slave[url_key] %}
{% 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
[dynamic-publish-slave-information]
< = jinja2-template-base
template = {{ template_publish_slave_information }}
template = {{ parameter_dict['profile_replicate_publish_slave_information'] }}
filename = dynamic-publish-slave-information.cfg
extensions = jinja2.ext.do
extra-context =
......@@ -773,8 +773,8 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg
[buildout]
extends =
{{ profile_common }}
{{ profile_monitor2 }}
{{ parameter_dict['profile_common'] }}
{{ parameter_dict['profile_monitor2'] }}
parts =
monitor-base
publish-slave-information
......
{%- if slap_software_type == software_type -%}
{%- if instance_parameter['slap-software-type'] == software_type -%}
{% import "caucase" as caucase with context %}
# KeDiFa instance profile
[buildout]
......@@ -311,4 +311,4 @@ name = ${:_buildout_section_name_}.py
config-command =
${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}
extra-context =
context =
import json_module json
key slap_software_type instance-parameter:slap-software-type
key slapparameter_dict instance-parameter:configuration
key slave_instance_list instance-parameter:slave-instance-list
section instance_parameter instance-parameter
......@@ -58,12 +57,8 @@ extra-context =
import functools_module functools
import validators validators
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.
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'] }}
import-list =
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