tripleo-common/releasenotes/notes/jinja2-template-render-raise-extension-87c7ed150a252ff5.yaml
Harald Jensås 675f8bc64f Jinja2 raise extension
Extend Jinja2 envrionment with a raise method so that
we can add logic in Jinja2 and raise errors.

In jinja2 template the raise method can be used like this:

 {%- if condition %}
   {{ raise('MESSAGE') }}
 {%- endif %}

Change-Id: Idaa1d570b129aa6c8c117b8087d1aad7ae987a47
2020-05-11 11:02:00 +02:00

13 lines
464 B
YAML

---
other:
- |
The jinja2 template rendering function is extensended with a ``raise``
method. This can be used to raise errors conditionally in the Jinja2
templated tripleo-heat-tempaltes, for example in case some required property
is not defined in roles_data or network_data. The following example
demonstrates how to raise an error conditionally in a template::
{%- if condition %}
{{ raise('MESSAGE') }}
{%- endif %}