Commit 75335ae8 authored by Łukasz Nowak's avatar Łukasz Nowak

XXX: Fix unique_by_network support to be more specific

parent 6edf7a50
...@@ -30,7 +30,7 @@ md5sum = 1b8645835f04081861266436505fd28f ...@@ -30,7 +30,7 @@ md5sum = 1b8645835f04081861266436505fd28f
[template-replicated] [template-replicated]
filename = template-replicated.cfg.in filename = template-replicated.cfg.in
md5sum = 52762882e0d631f51d2c9e5f8b31c0b6 md5sum = 67c863b15dbfa937babdbd620f95c1ff
[template-parts] [template-parts]
filename = template-parts.cfg.in filename = template-parts.cfg.in
......
...@@ -48,25 +48,25 @@ config-{{ parameter_name }} = {{ dumps(parameter_value) }} ...@@ -48,25 +48,25 @@ config-{{ parameter_name }} = {{ dumps(parameter_value) }}
{% for key, value in six.iteritems(monitor_dict) -%} {% for key, value in six.iteritems(monitor_dict) -%}
config-{{ key }} = {{ value }} config-{{ key }} = {{ value }}
{% endfor -%} {% endfor -%}
{% if sla_parameter_dict == {} -%} {% set sla_key_main = "-sla-%s%s-" % (namebase, 0) -%}
{% set sla_key_secondary = "-sla-%s-" % (0) -%}
{% set sla_key_main_length = sla_key_main | length -%}
{% set sla_key_secondary_length = sla_key_secondary | length -%}
{% set sla_dict = {} -%}
{% for key in sla_parameter_dict.keys() -%}
{% if key.startswith(sla_key_main) -%}
{% do sla_dict.__setitem__(key[sla_key_main_length:], sla_parameter_dict.get(key)) -%}
{% elif key.startswith(sla_key_secondary) and key[sla_key_secondary_length:] not in sla_dict -%}
{% do sla_dict.__setitem__(key[sla_key_secondary_length:], sla_parameter_dict.get(key)) -%}
{% endif -%}
{% endfor -%}
{% if sla_dict == {} %}
sla-mode = unique_by_network sla-mode = unique_by_network
{% else %} {% else %}
{% set sla_key_main = "-sla-%s%s-" % (namebase, 0) -%}
{% set sla_key_secondary = "-sla-%s-" % (0) -%}
{% set sla_key_main_length = sla_key_main | length -%}
{% set sla_key_secondary_length = sla_key_secondary | length -%}
{% set sla_dict = {} -%}
{% for key in sla_parameter_dict.keys() -%}
{% if key.startswith(sla_key_main) -%}
{% do sla_dict.__setitem__(key[sla_key_main_length:], sla_parameter_dict.get(key)) -%}
{% elif key.startswith(sla_key_secondary) and key[sla_key_secondary_length:] not in sla_dict -%}
{% do sla_dict.__setitem__(key[sla_key_secondary_length:], sla_parameter_dict.get(key)) -%}
{% endif -%}
{% endfor -%}
{% for key, value in six.iteritems(sla_dict) -%} {% for key, value in six.iteritems(sla_dict) -%}
sla-{{ key }} = {{ value }} sla-{{ key }} = {{ value }}
{% endfor -%} {% endfor %}
{% endif -%} {% endif %}
{% if 'monitor-base-url' in monitor_return and not monitor_parameter_dict.get('set-monitor-url', False) -%} {% if 'monitor-base-url' in monitor_return and not monitor_parameter_dict.get('set-monitor-url', False) -%}
{% do monitor_url_list.append('${request-' ~ namebase ~ ':connection-monitor-base-url}') -%} {% do monitor_url_list.append('${request-' ~ namebase ~ ':connection-monitor-base-url}') -%}
...@@ -100,24 +100,24 @@ config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url} ...@@ -100,24 +100,24 @@ config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}
{% for key, value in six.iteritems(monitor_dict) -%} {% for key, value in six.iteritems(monitor_dict) -%}
config-{{ key }} = {{ value }} config-{{ key }} = {{ value }}
{% endfor -%} {% endfor -%}
{% if sla_parameter_dict == {} -%} {% set sla_key_main = "-sla-%s%s-" % (namebase, id) -%}
{% set sla_key_secondary = "-sla-%s-" % (id) -%}
{% set sla_key_main_length = sla_key_main | length -%}
{% set sla_key_secondary_length = sla_key_secondary | length -%}
{% set sla_dict = {} -%}
{% for key in sla_parameter_dict.keys() -%}
{% if key.startswith(sla_key_main) -%}
{% do sla_dict.__setitem__(key[sla_key_main_length:], sla_parameter_dict.get(key)) -%}
{% elif key.startswith(sla_key_secondary) and key[sla_key_secondary_length:] not in sla_dict -%}
{% do sla_dict.__setitem__(key[sla_key_secondary_length:], sla_parameter_dict.get(key)) -%}
{% endif -%}
{% endfor -%}
{% if sla_dict == {} %}
sla-mode = unique_by_network sla-mode = unique_by_network
{% else %} {% else %}
{% set sla_key_main = "-sla-%s%s-" % (namebase, id) -%}
{% set sla_key_secondary = "-sla-%s-" % (id) -%}
{% set sla_key_main_length = sla_key_main | length -%}
{% set sla_key_secondary_length = sla_key_secondary | length -%}
{% set sla_dict = {} -%}
{% for key in sla_parameter_dict.keys() -%}
{% if key.startswith(sla_key_main) -%}
{% do sla_dict.__setitem__(key[sla_key_main_length:], sla_parameter_dict.get(key)) -%}
{% elif key.startswith(sla_key_secondary) and key[sla_key_secondary_length:] not in sla_dict -%}
{% do sla_dict.__setitem__(key[sla_key_secondary_length:], sla_parameter_dict.get(key)) -%}
{% endif -%}
{% endfor -%}
{% for key, value in six.iteritems(sla_dict) -%} {% for key, value in six.iteritems(sla_dict) -%}
sla-{{ key }} = {{ value }} sla-{{ key }} = {{ value }}
{% endfor -%} {% endfor %}
{% endif %} {% endif %}
[publish-connection-information] [publish-connection-information]
...@@ -202,21 +202,21 @@ config-{{ key }} = {{ value }} ...@@ -202,21 +202,21 @@ config-{{ key }} = {{ value }}
{% endfor -%} {% endfor -%}
return = ssh-key notification-url feeds-url {{ monitor_return }} return = ssh-key notification-url feeds-url {{ monitor_return }}
shared = false shared = false
{% if sla_parameter_dict == {} -%} {% set sla_key_main = "-sla-%s%s-" % ("pbs", id) -%}
{% set sla_key_secondary = "-sla-%s-" % (id) -%}
{% set sla_key_main_length = sla_key_main | length -%}
{% set sla_key_secondary_length = sla_key_secondary | length -%}
{% set sla_dict = {} -%}
{% for key in sla_parameter_dict.keys() -%}
{% if key.startswith(sla_key_main) -%}
{% do sla_dict.__setitem__(key[sla_key_main_length:], sla_parameter_dict.get(key)) -%}
{% elif key.startswith(sla_key_secondary) and key[sla_key_secondary_length:] not in sla_dict -%}
{% do sla_dict.__setitem__(key[sla_key_secondary_length:], sla_parameter_dict.get(key)) -%}
{% endif -%}
{% endfor -%}
{% if sla_dict == {} %}
sla-mode = unique_by_network sla-mode = unique_by_network
{% else %} {% else %}
{% set sla_key_main = "-sla-%s%s-" % ("pbs", id) -%}
{% set sla_key_secondary = "-sla-%s-" % (id) -%}
{% set sla_key_main_length = sla_key_main | length -%}
{% set sla_key_secondary_length = sla_key_secondary | length -%}
{% set sla_dict = {} -%}
{% for key in sla_parameter_dict.keys() -%}
{% if key.startswith(sla_key_main) -%}
{% do sla_dict.__setitem__(key[sla_key_main_length:], sla_parameter_dict.get(key)) -%}
{% elif key.startswith(sla_key_secondary) and key[sla_key_secondary_length:] not in sla_dict -%}
{% do sla_dict.__setitem__(key[sla_key_secondary_length:], sla_parameter_dict.get(key)) -%}
{% endif -%}
{% endfor -%}
{% for key, value in six.iteritems(sla_dict) -%} {% for key, value in six.iteritems(sla_dict) -%}
sla-{{ key }} = {{ value }} sla-{{ key }} = {{ value }}
{% endfor %} {% 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