diff --git a/templates/db.j2 b/templates/db.j2 index d70c5c0..eec74f3 100644 --- a/templates/db.j2 +++ b/templates/db.j2 @@ -12,6 +12,12 @@ $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 }} +{% elif entry.type|upper == 'TXT' %} +{{ entry.name }} 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 }} {% endif %} diff --git a/tests/bind.yml b/tests/bind.yml index d6cd148..2362db8 100644 --- a/tests/bind.yml +++ b/tests/bind.yml @@ -28,6 +28,7 @@ entries: - { name: '@', type: mx, priority: 20, value: mail.test.local. } - { name: '@', type: ns, value: localhost. } + - { name: '@', type: txt, value: RFufr9qzCi9vnJeWUB2FMNDCtu8ZtP6WE2jl2OFvIiz6pv2dwfzEXBgTC8SI1UzsmlkFYS7vxkHeYuOCLQ95BkOl0YP85ejQQlz8DNbcMcUdAoDtmlaZ9jeXnU7RgCXs5F9ggsmM9B6mFMhZWo1lzwsX86UAR5nw7rIO3cbGo9oUcMTShVFDkTPnoNhP7MTE0L4M99yv8ZLptmS2GP6goHXZgTdFIyYCdfziQgoENcloUI3KshDscsoh6H6I2LA } - { name: hello, type: a, value: 4.3.2.1 } roles: diff --git a/tests/spec/bind.rb b/tests/spec/bind.rb index ce130ce..ddc6b57 100644 --- a/tests/spec/bind.rb +++ b/tests/spec/bind.rb @@ -55,3 +55,8 @@ describe command('host hello.hello.local 127.0.0.1') do its(:exit_status) { should eq 0 } its(:stdout) { should contain('4.3.2.1') } end + +describe command('host -t TXT hello.local 127.0.0.1') do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain('hello.local descriptive text') } +end