Commit b76207ac authored by Hardik Juneja's avatar Hardik Juneja Committed by Rafael Monnerat

stack: Use monitor-base-url-dict section to collect monitor-urls and fix password storage_path

parent 485a875b
...@@ -79,7 +79,7 @@ md5sum = d41d8cd98f00b204e9800998ecf8427e ...@@ -79,7 +79,7 @@ md5sum = d41d8cd98f00b204e9800998ecf8427e
[template-erp5] [template-erp5]
filename = instance-erp5.cfg.in filename = instance-erp5.cfg.in
md5sum = bbb6ae266bf906690513c9996bc17fbc md5sum = b78f17dbef151a65a37924b4613e772d
[template-zeo] [template-zeo]
filename = instance-zeo.cfg.in filename = instance-zeo.cfg.in
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
{% set jupyter_dict = slapparameter_dict.get('jupyter', {}) -%} {% set jupyter_dict = slapparameter_dict.get('jupyter', {}) -%}
{% set has_jupyter = jupyter_dict.get('enable', jupyter_enable_default.lower() in ('true', 'yes')) -%} {% set has_jupyter = jupyter_dict.get('enable', jupyter_enable_default.lower() in ('true', 'yes')) -%}
{% set jupyter_zope_family = jupyter_dict.get('zope-family', '') -%} {% set jupyter_zope_family = jupyter_dict.get('zope-family', '') -%}
{% set monitor_base_url_list = [] -%} {% set monitor_base_url_dict = {} -%}
[request-common] [request-common]
<= request-common-base <= request-common-base
config-use-ipv6 = {{ dumps(slapparameter_dict.get('use-ipv6', False)) }} config-use-ipv6 = {{ dumps(slapparameter_dict.get('use-ipv6', False)) }}
...@@ -26,7 +26,7 @@ return = {{ ' '.join(ret) }} ...@@ -26,7 +26,7 @@ return = {{ ' '.join(ret) }}
{% do publish_dict.__setitem__(name ~ '-' ~ ret, '${' ~ section ~ ':connection-' ~ ret ~ '}') %} {% do publish_dict.__setitem__(name ~ '-' ~ ret, '${' ~ section ~ ':connection-' ~ ret ~ '}') %}
{% endif -%} {% endif -%}
{% if ret == "monitor-base-url" -%} {% if ret == "monitor-base-url" -%}
{% do monitor_base_url_list.append('${' ~ section ~ ':connection-' ~ ret ~ '}') -%} {% do monitor_base_url_dict.__setitem__(section, '${' ~ section ~ ':connection-' ~ ret ~ '}') -%}
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
{{ root_common.sla(name) }} {{ root_common.sla(name) }}
...@@ -182,7 +182,7 @@ software-type = zope ...@@ -182,7 +182,7 @@ software-type = zope
[{{ section_name }}] [{{ section_name }}]
<= request-zope-base <= request-zope-base
name = {{ partition_name }} name = {{ partition_name }}
{% do monitor_base_url_list.append('${' ~ section_name ~ ':connection-monitor-base-url}') -%} {% do monitor_base_url_dict.__setitem__(section_name, '${' ~ section_name ~ ':connection-monitor-base-url}') -%}
{{ root_common.sla(partition_name) }} {{ root_common.sla(partition_name) }}
config-name = {{ dumps(custom_name) }} config-name = {{ dumps(custom_name) }}
config-instance-count = {{ dumps(zope_parameter_dict.get('instance-count', 1)) }} config-instance-count = {{ dumps(zope_parameter_dict.get('instance-count', 1)) }}
...@@ -247,7 +247,7 @@ return = ...@@ -247,7 +247,7 @@ return =
{{ family }} {{ family }}
{{ family }}-v6 {{ family }}-v6
{% endfor -%} {% endfor -%}
{% do monitor_base_url_list.append('${' ~ 'request-balancer' ~ ':connection-monitor-base-url}') -%} {% do monitor_base_url_dict.__setitem__('request-balancer', '${' ~ 'request-balancer' ~ ':connection-monitor-base-url}') -%}
config-zope-family-dict = {{ dumps(zope_family_parameter_dict) }} config-zope-family-dict = {{ dumps(zope_family_parameter_dict) }}
config-tcpv4-port = {{ dumps(balancer_dict.get('tcpv4-port', 2150)) }} config-tcpv4-port = {{ dumps(balancer_dict.get('tcpv4-port', 2150)) }}
...@@ -283,6 +283,7 @@ return = site_url ...@@ -283,6 +283,7 @@ return = site_url
{% endif -%}{# if zope_partition_dict -#} {% endif -%}{# if zope_partition_dict -#}
[publish] [publish]
<= monitor-publish
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
-extends = publish-early -extends = publish-early
{% if 'neo' in storage_dict -%} {% if 'neo' in storage_dict -%}
...@@ -300,26 +301,17 @@ hosts-dict = {{ '${' ~ zope_address_list_id_dict.keys()[0] ~ ':connection-hosts- ...@@ -300,26 +301,17 @@ hosts-dict = {{ '${' ~ zope_address_list_id_dict.keys()[0] ~ ':connection-hosts-
{{ name }} = {{ value }} {{ name }} = {{ value }}
{% endfor -%} {% endfor -%}
[buildout]
extends = {{ monitor_template }}
parts +=
monitor-base
[monitor-instance-parameter] [monitor-instance-parameter]
monitor-httpd-port = 8386 monitor-httpd-port = 8386
{{ root_common.common_section() }} {{ root_common.common_section() }}
[buildout] [buildout]
extends = extends = {{ template_monitor }}
{{ template_monitor }}
parts += parts +=
monitor-base monitor-base
[publish-connection-information]
<= monitor-publish
[monitor-conf-parameters] [monitor-conf-parameters]
monitor-title = ERP5 monitor monitor-title = ERP5 monitor
password = ${monitor-htpasswd:passwd} password = ${monitor-htpasswd:passwd}
...@@ -329,3 +321,7 @@ password = ${monitor-htpasswd:passwd} ...@@ -329,3 +321,7 @@ password = ${monitor-htpasswd:passwd}
{{ key }} = {{ value }} {{ key }} = {{ value }}
{% endfor %} {% endfor %}
[monitor-base-url-dict]
{% for key, value in monitor_base_url_dict.items() -%}
{{ key }} = {{ value }}
{% endfor %}
...@@ -72,7 +72,7 @@ md5sum = 1695c9a06a2b11ccfe893d7a224e489d ...@@ -72,7 +72,7 @@ md5sum = 1695c9a06a2b11ccfe893d7a224e489d
[monitor-conf] [monitor-conf]
<= monitor-template-base <= monitor-template-base
filename = monitor.conf.in filename = monitor.conf.in
md5sum = c8f024d741c6494d7c9ba01601d0b917 md5sum = fc65084dd1c2fe2487b58a003b576f61
[monitor-instance-info] [monitor-instance-info]
<= monitor-template-base <= monitor-template-base
......
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
# not need these here). # not need these here).
[monitor2-template] [monitor2-template]
filename = instance-monitor.cfg.jinja2.in filename = instance-monitor.cfg.jinja2.in
md5sum = 628cc0b2b6104d9d2df8408028bad694 md5sum = 5027f0b1abcc28ce3817cd70fb667a3b
...@@ -122,12 +122,16 @@ command = ...@@ -122,12 +122,16 @@ command =
echo "20" > ${:file} echo "20" > ${:file}
fi fi
[monitor-base-url-dict]
# place holder to be used to collect erp5 monitor urls
[monitor-conf] [monitor-conf]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = {{ monitor_conf_template }} template = {{ monitor_conf_template }}
rendered = ${directory:etc}/${:filename} rendered = ${directory:etc}/${:filename}
filename = monitor.conf filename = monitor.conf
context = section parameter_dict monitor-conf-parameters context = section parameter_dict monitor-conf-parameters
section monitor_base_urls monitor-base-url-dict
[instance-info-parameters] [instance-info-parameters]
name = ${monitor-instance-parameter:monitor-title} name = ${monitor-instance-parameter:monitor-title}
......
[monitor] [monitor]
{% for key, value in parameter_dict.items() -%} {% for key, value in parameter_dict.items() -%}
{% if key == "monitor-url-list" and monitor_base_urls is defined -%}
{{ key }} =
{% for key, value in monitor_base_urls.items() -%}
{{ ' ' ~ value }}
{% endfor -%}
{% else -%}
{{ key }} = {{ value.strip().replace("\n", "\n ") }} {{ key }} = {{ value.strip().replace("\n", "\n ") }}
{% endfor -%} {% endif -%}
\ No newline at end of file {% endfor -%}
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