Add support for boolean values in haproxy global config, fix for log list default values
Related: PROD-29206 and PROD-29088
Fixes: PROD-29911
Change-Id: Ib4b08547ca2cc4badfe729ebafdf7408612051cc
diff --git a/haproxy/files/haproxy.cfg b/haproxy/files/haproxy.cfg
index 0ec1cd5..de8d89c 100644
--- a/haproxy/files/haproxy.cfg
+++ b/haproxy/files/haproxy.cfg
@@ -6,8 +6,10 @@
{%- for value in param %} {# Iterate through list #}
{{ param_name|replace('_', '.') }} {{ value }} {# Add each value from list #}
{%- endfor %}
- {%- elif (param is string and param != '') or param is number %} {# Param is a String and is not empty #}
- {{ param_name|replace('_', '.') }} {{ param }} {# Add String value #}
+ {%- elif param == true or param|lower == 'true' %} {# Param is boolean and true #}
+ {{ param_name|replace('_', '.') }} {# Add param name if value is true #}
+ {%- elif (param is string and param != '' and param|lower != 'false') or (param is number and param != false) %} {# Param is a string and is not empty or is a number #}
+ {{ param_name|replace('_', '.') }} {{ param }} {# Add a string value #}
{%- endif %}
{%- endfor %}
diff --git a/haproxy/map.jinja b/haproxy/map.jinja
index 3f437af..4167a2f 100644
--- a/haproxy/map.jinja
+++ b/haproxy/map.jinja
@@ -14,8 +14,8 @@
'group': 'haproxy',
'cpu-map': cpu_map_pillar,
'log': [
- '/dev/log local0'
- '/dev/log local1 notice'
+ '/dev/log local0',
+ '/dev/log local1 notice',
],
'log-send-hostname': '',
'nbproc': salt['pillar.get'](key='haproxy:proxy:nbproc', default=''),