From 8ba3ef37d55fb197dd0706a2ef3b469ca0afa90a Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 12 Apr 2022 20:01:14 +0200 Subject: frr: rpki: T4353: add ".j2" file extension on Jinja2 template --- data/templates/frr/rpki.frr.j2 | 18 ++++++++++++++++++ data/templates/frr/rpki.frr.tmpl.j2 | 18 ------------------ src/conf_mode/protocols_rpki.py | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 data/templates/frr/rpki.frr.j2 delete mode 100644 data/templates/frr/rpki.frr.tmpl.j2 diff --git a/data/templates/frr/rpki.frr.j2 b/data/templates/frr/rpki.frr.j2 new file mode 100644 index 000000000..9a549d6de --- /dev/null +++ b/data/templates/frr/rpki.frr.j2 @@ -0,0 +1,18 @@ +! +{# as FRR does not support deleting the entire rpki section we leave it in place even when it's empty #} +rpki +{% if cache is vyos_defined %} +{% for peer, peer_config in cache.items() %} +{# port is mandatory and preference uses a default value #} +{% if peer_config.ssh.username is vyos_defined %} + rpki cache {{ peer | replace('_', '-') }} {{ peer_config.port }} {{ peer_config.ssh.username }} {{ peer_config.ssh.private_key_file }} {{ peer_config.ssh.public_key_file }} {{ peer_config.ssh.known_hosts_file }} preference {{ peer_config.preference }} +{% else %} + rpki cache {{ peer | replace('_', '-') }} {{ peer_config.port }} preference {{ peer_config.preference }} +{% endif %} +{% endfor %} +{% endif %} +{% if polling_period is vyos_defined %} + rpki polling_period {{ polling_period }} +{% endif %} +exit +! diff --git a/data/templates/frr/rpki.frr.tmpl.j2 b/data/templates/frr/rpki.frr.tmpl.j2 deleted file mode 100644 index 9a549d6de..000000000 --- a/data/templates/frr/rpki.frr.tmpl.j2 +++ /dev/null @@ -1,18 +0,0 @@ -! -{# as FRR does not support deleting the entire rpki section we leave it in place even when it's empty #} -rpki -{% if cache is vyos_defined %} -{% for peer, peer_config in cache.items() %} -{# port is mandatory and preference uses a default value #} -{% if peer_config.ssh.username is vyos_defined %} - rpki cache {{ peer | replace('_', '-') }} {{ peer_config.port }} {{ peer_config.ssh.username }} {{ peer_config.ssh.private_key_file }} {{ peer_config.ssh.public_key_file }} {{ peer_config.ssh.known_hosts_file }} preference {{ peer_config.preference }} -{% else %} - rpki cache {{ peer | replace('_', '-') }} {{ peer_config.port }} preference {{ peer_config.preference }} -{% endif %} -{% endfor %} -{% endif %} -{% if polling_period is vyos_defined %} - rpki polling_period {{ polling_period }} -{% endif %} -exit -! diff --git a/src/conf_mode/protocols_rpki.py b/src/conf_mode/protocols_rpki.py index 51ad0d315..62ea9c878 100755 --- a/src/conf_mode/protocols_rpki.py +++ b/src/conf_mode/protocols_rpki.py @@ -81,7 +81,7 @@ def verify(rpki): def generate(rpki): if not rpki: return - rpki['new_frr_config'] = render_to_string('frr/rpki.frr.tmpl', rpki) + rpki['new_frr_config'] = render_to_string('frr/rpki.frr.j2', rpki) return None def apply(rpki): -- cgit v1.2.3