
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
13 lines
464 B
YAML
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 %}
|