From 267e27680a6bfab228bf1e62c9a9f84d189eacd2 Mon Sep 17 00:00:00 2001 From: Marvin Frick Date: Wed, 29 Jul 2015 12:25:43 +0200 Subject: [PATCH] adds some default values for essential params With this PR the haproxy.config state will actually render a valid haproxy.cfg from default values, even when the values are not explicitely passed via the pillar. Right now, an invalid cfg is generated which breaks haproxy on startup. --- haproxy/templates/haproxy.jinja | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/haproxy/templates/haproxy.jinja b/haproxy/templates/haproxy.jinja index 3f6c548..60469a7 100644 --- a/haproxy/templates/haproxy.jinja +++ b/haproxy/templates/haproxy.jinja @@ -31,9 +31,9 @@ global # use- if not designated in their block #------------------ defaults - log {{ salt['pillar.get']('haproxy:defaults:log') }} - mode {{ salt['pillar.get']('haproxy:defaults:mode') }} - retries {{ salt['pillar.get']('haproxy:defaults:retries') }} + log {{ salt['pillar.get']('haproxy:defaults:log', 'global')}} + mode {{ salt['pillar.get']('haproxy:defaults:mode', 'http') }} + retries {{ salt['pillar.get']('haproxy:defaults:retries', '3') }} balance {{ salt['pillar.get']('haproxy:defaults:balance', 'roundrobin') }} {%- if 'options' in salt['pillar.get']('haproxy:defaults', {}) %} {%- for option in salt['pillar.get']('haproxy:defaults:options') %} @@ -44,7 +44,11 @@ defaults {%- for timeout in salt['pillar.get']('haproxy:defaults:timeouts') %} timeout {{ timeout }} {%- endfor %} -{% endif %} +{%- else %} + timeout client 1m + timeout connect 10s + timeout server 1m +{%- endif %} {%- if 'errorfiles' in salt['pillar.get']('haproxy:defaults', {}) %} {%- for errorfile in salt['pillar.get']('haproxy:defaults:errorfiles').iteritems() %} errorfile {{ errorfile[0] }} {{ errorfile[1] }}