prometheus-formula/prometheus/files/macros.jinja
N ce5b7712c9 refactor(all): align to template-formula; add clientlibs feature
BREAKING CHANGE: The data dictionary is simplified and expanded.
Retest your states and update pillar data accordingly.
For developer convenience, clientlibs states were introduced.
See pillar.example, defaults.yaml, and docs/README.
2020-05-15 11:12:28 +01:00

31 lines
695 B
Django/Jinja

# -*- coding: utf-8 -*-
# vim: ft=jinja
#
# Collection of common macros
{%- macro format_kwargs(kwarg) -%}
{%- filter indent(4) %}
{%- for k, v in kwarg|dictsort() %}
- {{ k }}: {{ v }}
{%- endfor %}
{%- endfilter %}
{%- endmacro %}
{%- macro concat_args(args) %}
{%- set args = args|dictsort %}
{%- if args|length > 0 %}
{%- for k,v in args -%}
{%- if not k or not v %}{% continue %}{% endif -%}
{%- if v == True -%}
--{{ k }}
{%- elif v == False -%}
--no-{{ k }}
{%- else -%}
--{{ k }}={{ v }}
{%- endif -%}
{%- if not loop.last %} {% endif -%}
{%- endfor -%}
{%- endif -%}
{%- endmacro %}