From 52d5fa2d3f63cc4e2f88a1c5a8fc14f86e38abb2 Mon Sep 17 00:00:00 2001 From: Daniel Akulenok Date: Tue, 14 May 2024 14:12:19 +0200 Subject: [PATCH] Demacro --- templates/named.conf.generator.j2 | 7 ++----- templates/named.conf.logging.j2 | 6 ++---- templates/named.conf.parental-agents.j2 | 4 +--- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/templates/named.conf.generator.j2 b/templates/named.conf.generator.j2 index 7a3c4d8..16d74ff 100644 --- a/templates/named.conf.generator.j2 +++ b/templates/named.conf.generator.j2 @@ -34,15 +34,12 @@ options { {% endif %} {% if item.keylist is defined and item.keylist %} {% include 'named.conf.key.j2' %} -{{ keylist(item.keylist) }} {% endif %} {% if item.logging is defined and item.logging %} -{% from 'named.conf.logging.j2' import logging with context %} -{{ logging(item.logging) }} +{% include 'named.conf.logging.j2' %} {% endif %} {% if item.parental_agents is defined and item.parental_agents %} -{% from 'named.conf.parental-agents.j2' import parental_agents with context %} -{{ parental_agents(item.parental_agents) -}} +{% include 'named.conf.parental-agents.j2' %} {% endif %} {% if item.server is defined and item.server %} {% from 'named.conf.server.j2' import server with context %} diff --git a/templates/named.conf.logging.j2 b/templates/named.conf.logging.j2 index f4935d4..19f3814 100644 --- a/templates/named.conf.logging.j2 +++ b/templates/named.conf.logging.j2 @@ -1,11 +1,10 @@ -{% macro logging(logging) %} logging { {% filter indent(bind9_config_indent, true) %} -{% for category in logging.categories if logging.categories is defined and logging.categories %} +{% for category in item.logging.categories if item.logging.categories is defined and item.logging.categories %} category {{ category.name }} { {{ functions.simple_item_list(category.channels) }}}; {% endfor %} -{% for channel in logging.channels if logging.channels is defined and logging.channels %} +{% for channel in item.logging.channels if item.logging.channels is defined and item.logging.channels %} channel {{ channel.name }} { {% filter indent(bind9_config_indent, true) %} {% if channel.file is defined and channel.file %} @@ -26,4 +25,3 @@ file "{{ channel.file.name }}" }; {% endfor %} {% endfilter %}}; -{% endmacro %} \ No newline at end of file diff --git a/templates/named.conf.parental-agents.j2 b/templates/named.conf.parental-agents.j2 index 8999a34..e191901 100644 --- a/templates/named.conf.parental-agents.j2 +++ b/templates/named.conf.parental-agents.j2 @@ -1,9 +1,7 @@ -{% macro parental_agents(parental_agents) %} -{% for agent in parental_agents if parental_agents is iterable %} +{% for agent in item.parental_agents if item.parental_agents is iterable %} parental-agents {{ agent.name -}} {{ (' port ' + agent.port | string) if agent.port is defined and agent.port -}} {{ (' dscp ' + agent.dscp | string) if agent.dscp is defined and agent.dscp }} { {{ functions.list_address_port_key_tls(agent.addresses) -}}}; {% endfor %} -{% endmacro %} \ No newline at end of file