Skip to content

Commit

Permalink
Merge pull request #80 from floored1585/template_whitespace
Browse files Browse the repository at this point in the history
cleaning up template whitespace
  • Loading branch information
tersmitten authored May 19, 2020
2 parents 9f7c110 + 837292a commit 6801a5f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 123 deletions.
33 changes: 3 additions & 30 deletions templates/etc/haproxy/backend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,81 +3,63 @@ backend {{ backend.name }}
{% if backend.description is defined %}
description {{ backend.description }}
{% endif %}

{% if backend.bind_process is defined %}
bind-process {{ backend.bind_process | join(' ') }}
{% endif %}

mode {{ backend.mode }}

balance {{ backend.balance }}

{% if backend.source is defined %}
source {{ backend.source }}
{% endif %}

{% for option in backend.option | default([])%}
option {{ option }}
{% endfor %}

{% for option in backend.no_option | default([])%}
no option {{ option }}
{% endfor %}

{% if backend.http_check is defined %}
http-check {{ backend.http_check }}
{% endif %}

{% if backend.cookie is defined %}
cookie {{ backend.cookie }}
{% endif %}

{% for acl in backend.acl | default([]) %}
acl {{ acl.string }}
{% endfor %}

{% for stick in backend.stick | default([]) %}
stick-table {{ stick.table }}
stick on {{ stick.stick_on }}
{% endfor %}

{% for option in backend.no_option | default([]) %}
no option {{ option }}
{% endfor %}

{% if backend.no_log | default(false) == true %}
no log
{% endif %}

{% for tcp_check in backend.tcp_check | default([]) %}
tcp-check {{ tcp_check }}
{% endfor %}

{% for timeout in backend.timeout | default([]) %}
timeout {{ timeout.type }} {{ timeout.timeout }}
{% endfor %}

{% for action in ['reqadd', 'rspadd'] %}
{% for params in backend[action] | default([]) %}
{{ action }} {{ params.string }}{% if params.cond is defined %} {{ params.cond }}{% endif %}

{% endfor %}
{% endfor %}

{% for action in ['reqdel', 'reqidel', 'rspdel', 'rspidel'] %}
{% for params in backend[action] | default([]) %}
{{ action }} {{ params.search }}{% if params.cond is defined %} {{ params.cond }}{% endif %}

{% endfor %}
{% endfor %}

{% for action in ['reqrep', 'reqirep', 'rsprep', 'rspirep'] %}
{% for params in backend[action] | default([]) %}
{{ action }} {{ params.search }} {{ params.string }}{% if params.cond is defined %} {{ params.cond }}{% endif %}

{% endfor %}
{% endfor %}

{% if backend.stats is defined %}
{% if backend.stats.enable is defined and backend.stats.enable | bool == true %}
stats enable
Expand All @@ -93,58 +75,49 @@ backend {{ backend.name }}
{% endfor %}
{% for auth in backend.stats.auth | default([]) %}
stats auth {{ auth.user }}:{{ auth.passwd }}

{% endfor %}
{% endif %}
{% endif %}

{% for http_request in backend.http_request | default([]) %}
http-request {{ http_request.action }}{% if http_request.param is defined %} {{ http_request.param }}{% endif %}{% if http_request.cond is defined %} {{ http_request.cond }}{% endif %}

{% endfor %}

{% for tcp_request_inspect_delay in backend.tcp_request_inspect_delay | default([]) %}
tcp-request inspect-delay {{ tcp_request_inspect_delay.timeout }}

{% endfor %}

{% for tcp_request_content in backend.tcp_request_content | default([]) %}
tcp-request content {{ tcp_request_content.action }}{% if tcp_request_content.cond is defined %} {{ tcp_request_content.cond }}{% endif %}

{% endfor %}

{% for http_response in backend.http_response | default([]) %}
http-response {{ http_response.action }}{% if http_response.param is defined %} {{ http_response.param }}{% endif %}{% if http_response.cond is defined %} {{ http_response.cond }}{% endif %}

{% endfor %}

{% for compression in backend.compression | default([]) %}
compression {{ compression.name }} {{ compression.value }}
{% endfor %}

{% if backend.default_server_params | default([]) %}
default-server {% for param in backend.default_server_params | default([]) %} {{ param }}{% endfor %}
{% endif %}

{% endif %}
{% for server in backend.server | default([]) %}
server {{ server.name }} {{ server.listen }}{% for param in server.param | default([]) %} {{ param }}{% endfor %}

{% endfor %}
{% if backend.server_template is defined %}
server-template {{ backend.server_template.name }} {{ backend.server_template.num}} {{ backend.server_template.fqdn }}{% if backend.server_template.port is defined %}:{{ backend.server_template.port }}{% endif %} {% for param in backend.server_template.param | default([]) %} {{ param }}{% endfor %}
{% endif %}

{% endif %}
{% if backend.retry_on is defined %}
retry-on {% for r in backend.retry_on %}{{ r }} {% endfor %}
{% endif %}

{% endif %}
{% if backend.retries is defined %}
retries {{ backend.retries }}
{% endif %}
{% for errorfile in backend.errorfile | default([]) %}
errorfile {{ errorfile.code }} {{ errorfile.file }}
{% endfor %}

{% for line in backend.raw_options | default([]) %}
{{ line }}
{% endfor %}
Expand Down
8 changes: 0 additions & 8 deletions templates/etc/haproxy/defaults.cfg.j2
Original file line number Diff line number Diff line change
@@ -1,41 +1,33 @@
{% if haproxy_defaults_log != false %}
log {{ haproxy_defaults_log }}
{% endif %}

{% if haproxy_defaults_logformat is defined %}
log-format {{ haproxy_defaults_logformat }}
{% endif %}

{% if haproxy_defaults_mode != false %}
mode {{ haproxy_defaults_mode }}
{% endif %}

{% if haproxy_defaults_source is defined %}
source {{ haproxy_defaults_source }}
{% endif %}

{% if haproxy_defaults_option != false %}
{% for option in haproxy_defaults_option %}
option {{ option }}
{% endfor %}
{% endif %}

{% for option in haproxy_defaults_no_option | default([]) %}
no option {{ option }}
{% endfor %}

{% if haproxy_defaults_timeout != false %}
{% for timeout in haproxy_defaults_timeout %}
timeout {{ timeout.type }} {{ timeout.timeout }}
{% endfor %}
{% endif %}

{% if haproxy_defaults_errorfile != false %}
{% for errorfile in haproxy_defaults_errorfile %}
errorfile {{ errorfile.code }} {{ errorfile.file }}
{% endfor %}
{% endif %}

{% for compression in haproxy_defaults_compression | default([]) %}
compression {{ compression.name }} {{ compression.value }}
{% endfor %}
Expand Down
28 changes: 0 additions & 28 deletions templates/etc/haproxy/frontend.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,114 +3,89 @@ frontend {{ frontend.name }}
{% if frontend.description is defined %}
description {{ frontend.description }}
{% endif %}

{% for bind in frontend.bind %}
bind {{ bind.listen }}{% for param in bind.param | default([]) %} {{ param }}{% endfor %}

{% endfor %}

{% if frontend.bind_process is defined %}
bind-process {{ frontend.bind_process | join(' ') }}
{% endif %}

mode {{ frontend.mode }}

{% if frontend.maxconn is defined %}
maxconn {{ frontend.maxconn }}
{% endif %}

{% for stick in frontend.stick | default([]) %}
stick-table {{ stick.table }}
{% endfor %}

{% for option in frontend.option | default([]) %}
option {{ option }}
{% endfor %}

{% for option in frontend.no_option | default([]) %}
no option {{ option }}
{% endfor %}

{% if frontend.logformat is defined %}
log-format {{ frontend.logformat }}
{% endif %}

{% if frontend.no_log | default(false) == true %}
no log
{% endif %}

{% for timeout in frontend.timeout | default([]) %}
timeout {{ timeout.type }} {{ timeout.timeout }}
{% endfor %}

{% for acl in frontend.acl | default([]) %}
acl {{ acl.string }}
{% endfor %}

{% for capture in frontend.capture | default([]) %}
capture {{ capture.type }} {{ capture.name }} len {{ capture.length }}
{% endfor %}

{% for tcp_request_inspect_delay in frontend.tcp_request_inspect_delay | default([]) %}
tcp-request inspect-delay {{ tcp_request_inspect_delay.timeout }}

{% endfor %}

{% for tcp_request_connection in frontend.tcp_request_connection | default([]) %}
tcp-request connection {{ tcp_request_connection.action }}{% if tcp_request_connection.cond is defined %} {{ tcp_request_connection.cond }}{% endif %}

{% endfor %}

{% for tcp_request_content in frontend.tcp_request_content | default([]) %}
tcp-request content {{ tcp_request_content.action }}{% if tcp_request_content.cond is defined %} {{ tcp_request_content.cond }}{% endif %}

{% endfor %}

{% for tcp_request_session in frontend.tcp_request_session | default([]) %}
tcp-request session {{ tcp_request_session.action }}{% if tcp_request_session.cond is defined %} {{ tcp_request_session.cond }}{% endif %}

{% endfor %}

{% for http_request in frontend.http_request | default([]) %}
http-request {{ http_request.action }}{% if http_request.param is defined %} {{ http_request.param }}{% endif %}{% if http_request.cond is defined %} {{ http_request.cond }}{% endif %}

{% endfor %}

{% for http_response in frontend.http_response | default([]) %}
http-response {{ http_response.action }}{% if http_response.param is defined %} {{ http_response.param }}{% endif %}{% if http_response.cond is defined %} {{ http_response.cond }}{% endif %}

{% endfor %}

{% for action in ['reqadd', 'rspadd'] %}
{% for params in frontend[action] | default([]) %}
{{ action }} {{ params.string }}{% if params.cond is defined %} {{ params.cond }}{% endif %}

{% endfor %}
{% endfor %}

{% for action in ['reqdel', 'reqidel', 'rspdel', 'rspidel'] %}
{% for params in frontend[action] | default([]) %}
{{ action }} {{ params.search }}{% if params.cond is defined %} {{ params.cond }}{% endif %}

{% endfor %}
{% endfor %}

{% for action in ['reqrep', 'reqirep', 'rsprep', 'rspirep'] %}
{% for params in frontend[action] | default([]) %}
{{ action }} {{ params.search }} {{ params.string }}{% if params.cond is defined %} {{ params.cond }}{% endif %}

{% endfor %}
{% endfor %}

{% for redirect in frontend.redirect | default([]) %}
redirect {{ redirect.string }}{% if redirect.cond is defined %} {{ redirect.cond }}{% endif %}

{% endfor %}

{% for compression in frontend.compression | default([]) %}
compression {{ compression.name }} {{ compression.value }}
{% endfor %}

{% if frontend.use_backend is defined %}
{% if frontend.use_backend is iterable and frontend.use_backend is not string %}
{% for use_backend in frontend.use_backend | default([]) %}
Expand All @@ -120,15 +95,12 @@ frontend {{ frontend.name }}
use_backend {{ frontend.use_backend }}
{% endif %}
{% endif %}

{% if frontend.default_backend is defined %}
default_backend {{ frontend.default_backend }}
{% endif %}

{% for errorfile in frontend.errorfile | default([]) %}
errorfile {{ errorfile.code }} {{ errorfile.file }}
{% endfor %}

{% for line in frontend.raw_options | default([]) %}
{{ line }}
{% endfor %}
Expand Down
Loading

0 comments on commit 6801a5f

Please sign in to comment.