1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Switch to an explicit SUPPORTS setup

This commit is contained in:
Ross McFarland
2017-06-21 17:08:16 -07:00
parent a316bf578c
commit 852c101388
11 changed files with 32 additions and 16 deletions

View File

@@ -16,6 +16,9 @@ class BaseSource(object):
if not hasattr(self, 'SUPPORTS_GEO'):
raise NotImplementedError('Abstract base class, SUPPORTS_GEO '
'property missing')
if not hasattr(self, 'SUPPORTS'):
raise NotImplementedError('Abstract base class, SUPPORTS '
'property missing')
def populate(self, zone, target=False):
'''
@@ -25,9 +28,7 @@ class BaseSource(object):
'missing')
def supports(self, record):
# Unless overriden and handled appropriaitely we'll assume that all
# record types are supported
return True
return record._type in self.SUPPORTS
def __repr__(self):
return self.__class__.__name__

View File

@@ -19,6 +19,7 @@ from .base import BaseSource
class TinyDnsBaseSource(BaseSource):
SUPPORTS_GEO = False
SUPPORTS = set(('A', 'CNAME', 'MX', 'NS'))
split_re = re.compile(r':+')