From ce7777f2792c50a5ffd834dbabd7685d59de9649 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Sat, 17 Mar 2018 11:07:20 +0100 Subject: [PATCH] chore: rename entries by records --- README.md | 4 ++-- templates/db.j2 | 18 +++++++++--------- test/integration/bind/default.yml | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 422d614..3990c92 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ bind_zones: mail: root@test.local serial: 2017092202 dnssec: yes - entries: + records: - { name: '@', type: ns, value: localhost. } - { name: hello, type: a, ttl: 5m, value: 1.2.3.4 } - { name: hello, type: caa, flag: 0, tag: issue, value: letsencrypt.org } @@ -48,7 +48,7 @@ bind_zones: mail: root@hello.local serial: 2017092201 dnssec: no - entries: + records: - { name: '@', type: ns, value: localhost. } - { name: hello, type: a, value: 4.3.2.1 } ``` diff --git a/templates/db.j2 b/templates/db.j2 index 1657178..013cc98 100644 --- a/templates/db.j2 +++ b/templates/db.j2 @@ -9,19 +9,19 @@ $TTL {{ item.value.ttl|default(3600) }} {{ item.value.negative_cache|default(86400) }} ; Negative Cache TTL ) -{% for entry in item.value.entries %} -{% if entry.type|upper == 'MX' %} -{{ entry.name }} {{ entry.ttl|default(' ') }} IN MX {{ entry.priority }} {{ entry.value }} -{% elif entry.type|upper == 'CAA' %} -{{ entry.name }} {{ entry.ttl|default(' ') }} CAA {{ entry.flag }} {{ entry.tag }} "{{ entry.value }}" -{% elif entry.type|upper == 'TXT' %} -{{ entry.name }} {{ entry.ttl|default(' ') }} IN TXT ( -{% for charset in entry.value|batch(64) %} +{% for record in item.value.records %} +{% if record.type|upper == 'MX' %} +{{ record.name }} {{ record.ttl|default(' ') }} IN MX {{ record.priority }} {{ record.value }} +{% elif record.type|upper == 'CAA' %} +{{ record.name }} {{ record.ttl|default(' ') }} CAA {{ record.flag }} {{ record.tag }} "{{ record.value }}" +{% elif record.type|upper == 'TXT' %} +{{ record.name }} {{ record.ttl|default(' ') }} IN TXT ( +{% for charset in record.value|batch(64) %} "{{ charset|join('') }}" {% endfor %} ) {% else %} -{{ entry.name }} {{ entry.ttl|default(' ') }} IN {{ entry.type|upper }} {{ entry.value }} +{{ record.name }} {{ record.ttl|default(' ') }} IN {{ record.type|upper }} {{ record.value }} {% endif %} {% endfor %} {% if 'dnssec' in item.value and item.value.dnssec %} diff --git a/test/integration/bind/default.yml b/test/integration/bind/default.yml index 66cb829..5a4da04 100644 --- a/test/integration/bind/default.yml +++ b/test/integration/bind/default.yml @@ -16,7 +16,7 @@ expire: 2419200 negative_cache: 86400 dnssec: yes - entries: + records: - { name: '@', type: mx, priority: 20, value: mail.test.local. } - { name: '@', type: ns, value: localhost. } - { name: hello, type: a, ttl: 5m, value: 1.2.3.4 } @@ -27,7 +27,7 @@ mail: root@hello.local serial: 2017092201 dnssec: no - entries: + records: - { name: '@', type: mx, priority: 20, value: mail.test.local. } - { name: '@', type: ns, value: localhost. } - { name: '@', type: txt, value: RFufr9qzCi9vnJeWUB2FMNDCtu8ZtP6WE2jl2OFvIiz6pv2dwfzEXBgTC8SI1UzsmlkFYS7vxkHeYuOCLQ95BkOl0YP85ejQQlz8DNbcMcUdAoDtmlaZ9jeXnU7RgCXs5F9ggsmM9B6mFMhZWo1lzwsX86UAR5nw7rIO3cbGo9oUcMTShVFDkTPnoNhP7MTE0L4M99yv8ZLptmS2GP6goHXZgTdFIyYCdfziQgoENcloUI3KshDscsoh6H6I2LA }