summaryrefslogtreecommitdiff
path: root/schema
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-04-01 21:56:53 +0200
committerChristian Poessinger <christian@poessinger.com>2022-04-01 21:56:53 +0200
commit1684773712b92e70130b618937700b472da22fce (patch)
treedc7667081c9e10bb16f2ce7a33c5ab436ffeae86 /schema
parent3ce13fe3c5c4161825fb36174d0da18668dca80c (diff)
downloadvyos-1x-1684773712b92e70130b618937700b472da22fce.tar.gz
vyos-1x-1684773712b92e70130b618937700b472da22fce.zip
vyos.template: T4333: add Jinja2 plugin to test if a variable is defined and not none
We have a lot of boiler plate template code like {% if config.interface is defined and config.interface.remote_as is defined and config.interface.remote_as is not none %} ... {% endif %} This can be stripped down using a custom test to: {% if config.interface.remote_as is vyos_defined %} ... {% endif %} In addition the new vyos_defined test supports comparison {% if foo.bar.baz is vyos_defined('zoo') %} ... {% endif %} So the above will only evaluate to true if the variable foo.bar.baz is defined and its content is zoo This is inspired from https://github.com/aristanetworks/ansible-avd/ which make heavy use of it. All new templates should be written in this new style.
Diffstat (limited to 'schema')
0 files changed, 0 insertions, 0 deletions