From a46f82ba2ccb7b7088c74fee7164dc5565d319f6 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Sat, 17 Mar 2018 00:36:43 +0100 Subject: [PATCH] feat: add ttl for record --- README.md | 2 +- templates/db.j2 | 6 +++--- test/integration/bind/default.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b91a385..ad66fa3 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ bind_zones: dnssec: yes entries: - { name: '@', type: ns, value: localhost. } - - { name: hello, type: a, value: 1.2.3.4 } + - { name: hello, type: a, ttl: 5m, value: 1.2.3.4 } hello.local: ns_primary: ns1.hello.local mail: root@hello.local diff --git a/templates/db.j2 b/templates/db.j2 index a419be5..0e789ff 100644 --- a/templates/db.j2 +++ b/templates/db.j2 @@ -11,15 +11,15 @@ $TTL {{ item.value.ttl|default(3600) }} {% for entry in item.value.entries %} {% if entry.type|upper == 'MX' %} -{{ entry.name }}{% for i in range(0, 15 - entry.name|length) %} {% endfor %} IN MX {{ entry.priority }} {{ entry.value }} +{{ entry.name }} {{ entry.ttl|default(' ') }} IN MX {{ entry.priority }} {{ entry.value }} {% elif entry.type|upper == 'TXT' %} -{{ entry.name }}{% for i in range(0, 15 - entry.name|length) %} {% endfor %} IN {{ entry.type|upper }} ( +{{ entry.name }} {{ entry.ttl|default(' ') }} IN {{ entry.type|upper }} ( {% for charset in entry.value|batch(64) %} "{{ charset|join('') }}" {% endfor %} ) {% else %} -{{ entry.name }}{% for i in range(0, 15 - entry.name|length) %} {% endfor %} IN {{ entry.type|upper }}{% for i in range(0, 9 - entry.type|length) %} {% endfor %} {{ entry.value }} +{{ entry.name }} {{ entry.ttl|default(' ') }} IN {{ entry.type|upper }} {{ entry.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 e393ae4..8182afb 100644 --- a/test/integration/bind/default.yml +++ b/test/integration/bind/default.yml @@ -19,7 +19,7 @@ entries: - { name: '@', type: mx, priority: 20, value: mail.test.local. } - { name: '@', type: ns, value: localhost. } - - { name: hello, type: a, value: 1.2.3.4 } + - { name: hello, type: a, ttl: 5m, value: 1.2.3.4 } hello.local: ns_primary: ns1.hello.local mail: root@hello.local