From 3c595f487954af545cbabebc0523b2fa464e7d52 Mon Sep 17 00:00:00 2001 From: Daniel Akulenok Date: Tue, 14 May 2024 10:31:16 +0200 Subject: [PATCH] Demacro some more --- templates/named.conf.acl.j2 | 5 ++--- templates/named.conf.generator.j2 | 6 ++---- templates/named.conf.primaries.j2 | 4 +--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/templates/named.conf.acl.j2 b/templates/named.conf.acl.j2 index 2c4f9b5..89e454a 100644 --- a/templates/named.conf.acl.j2 +++ b/templates/named.conf.acl.j2 @@ -1,7 +1,6 @@ {# ACL Macro. Very easy statement. It's just a list of address match elements. #} -{% macro acl(acls) %} -{% for acl in acls %} +{% for acl in item.acl %} acl {{ acl.name }} { {{ functions.simple_item_list(acl.addresses) -}} }; -{% endfor %}{% endmacro %} \ No newline at end of file +{% endfor %} diff --git a/templates/named.conf.generator.j2 b/templates/named.conf.generator.j2 index ca40ba3..b5c0edf 100644 --- a/templates/named.conf.generator.j2 +++ b/templates/named.conf.generator.j2 @@ -9,12 +9,10 @@ options { {% endif %} {% if item.acl is defined and item.acl %} -{% from 'named.conf.acl.j2' import acl with context %} -{{ acl(item.acl) }} +{% include 'named.conf.acl.j2' %} {% endif %} {% if item.primaries is defined and item.primaries %} -{% from 'named.conf.primaries.j2' import primaries with context %} -{{ primaries(item.primaries) }} +{% include 'named.conf.primaries' %} {% endif %} {% if item.controls is defined and item.controls %} {% from 'named.conf.controls.j2' import controls with context %} diff --git a/templates/named.conf.primaries.j2 b/templates/named.conf.primaries.j2 index 8cec5a9..1411d29 100644 --- a/templates/named.conf.primaries.j2 +++ b/templates/named.conf.primaries.j2 @@ -1,8 +1,6 @@ -{% macro primaries(primaries) %} -{% for primary in primaries if primaries is iterable %} +{% for primary in item.primaries if primaries is iterable %} primaries {{ primary.name -}} {{ (' port ' + primary.port | string) if primary.port is defined and primary.port -}} {{ (' dscp ' + primary.dscp | string) if primary.dscp is defined and primary.dscp }} { {{ functions.list_address_port_key_tls(primary.addresses) -}}}; {% endfor %} -{% endmacro %} \ No newline at end of file