jinja variables check

Check if variable is defined and not empty:

{% if variable is defined and variable|length %}
    variable is defined and not empty
{% else %}
    variable is not defined or empty
{% endif %}
https://www.shellhacks.com/jinja2-check-if-variable-empty-exists-defined-true/

Leave a comment