mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Add support for TinyDNS TXT records
This commit is contained in:
19
octodns/source/tinydns.py
Normal file → Executable file
19
octodns/source/tinydns.py
Normal file → Executable file
@@ -20,7 +20,7 @@ from .base import BaseSource
|
||||
class TinyDnsBaseSource(BaseSource):
|
||||
SUPPORTS_GEO = False
|
||||
SUPPORTS_DYNAMIC = False
|
||||
SUPPORTS = set(('A', 'CNAME', 'MX', 'NS'))
|
||||
SUPPORTS = set(('A', 'CNAME', 'MX', 'NS', 'TXT'))
|
||||
|
||||
split_re = re.compile(r':+')
|
||||
|
||||
@@ -45,6 +45,22 @@ class TinyDnsBaseSource(BaseSource):
|
||||
'values': values,
|
||||
}
|
||||
|
||||
def _data_for_TXT(self, _type, records):
|
||||
values = []
|
||||
|
||||
for record in records:
|
||||
values.append(record[0].decode('unicode-escape'))
|
||||
|
||||
try:
|
||||
ttl = records[0][1]
|
||||
except IndexError:
|
||||
ttl = self.default_ttl
|
||||
return {
|
||||
'ttl': ttl,
|
||||
'type': _type,
|
||||
'values': values,
|
||||
}
|
||||
|
||||
def _data_for_CNAME(self, _type, records):
|
||||
first = records[0]
|
||||
try:
|
||||
@@ -104,6 +120,7 @@ class TinyDnsBaseSource(BaseSource):
|
||||
'C': 'CNAME',
|
||||
'+': 'A',
|
||||
'@': 'MX',
|
||||
'\'': 'TXT',
|
||||
}
|
||||
name_re = re.compile(r'((?P<name>.+)\.)?{}$'.format(zone.name[:-1]))
|
||||
|
||||
|
Reference in New Issue
Block a user