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

extract Route53Provider and AwsAcmMangingProcessor into their own module

This commit is contained in:
Ross McFarland
2022-01-03 09:24:50 -08:00
parent d3c9b31c01
commit f8240f0cbd
5 changed files with 41 additions and 5154 deletions

View File

@@ -3,6 +3,12 @@
#### Noteworthy changes
* Provider extraction has begun, see
https://github.com/octodns/octodns/issues/622 &
https://github.com/octodns/octodns/pull/822 for more information. Providers
that have been extracted in this release include:
* [Route53Provider](https://github.com/octodns/octodns-route53/) also
AwsAcmMangingProcessor
* NS1 provider has received improvements to the dynamic record implementation.
As a result, if octoDNS is downgraded from this version, any dynamic records
created or updated using this version will show an update.

View File

@@ -7,38 +7,16 @@ from __future__ import absolute_import, division, print_function, \
from logging import getLogger
from .base import BaseProcessor
class AwsAcmMangingProcessor(BaseProcessor):
'''
processors:
awsacm:
class: octodns.processor.acme.AwsAcmMangingProcessor
...
zones:
something.com.:
...
processors:
- awsacm
...
'''
log = getLogger('AwsAcmMangingProcessor')
def _ignore_awsacm_cnames(self, zone):
for r in zone.records:
if r._type == 'CNAME' and \
r.name.startswith('_') \
and r.value.endswith('.acm-validations.aws.'):
self.log.info('_process: ignoring %s', r.fqdn)
zone.remove_record(r)
return zone
def process_source_zone(self, desired, *args, **kwargs):
return self._ignore_awsacm_cnames(desired)
def process_target_zone(self, existing, *args, **kwargs):
return self._ignore_awsacm_cnames(existing)
logger = getLogger('Route53')
try:
logger.warn('octodns_route53 shimmed. Update your processor class to '
'octodns_route53.processor.AwsAcmMangingProcessor. '
'Shim will be removed in 1.0')
from octodns_route53.processor import AwsAcmMangingProcessor
AwsAcmMangingProcessor # pragma: no cover
except ModuleNotFoundError:
logger.exception('AwsAcmMangingProcessor has been moved into a seperate '
'module, octodns_route53 is now required. Processor '
'class should be updated to '
'octodns_route53.processor.AwsAcmMangingProcessor')
raise

View File

File diff suppressed because it is too large Load Diff

View File

@@ -7,64 +7,10 @@ from __future__ import absolute_import, division, print_function, \
from unittest import TestCase
from octodns.processor.awsacm import AwsAcmMangingProcessor
from octodns.record import Record
from octodns.zone import Zone
zone = Zone('unit.tests.', [])
records = {
'root': Record.new(zone, '_deadbeef', {
'ttl': 30,
'type': 'CNAME',
'value': '_0123456789abcdef.acm-validations.aws.',
}),
'sub': Record.new(zone, '_deadbeef.sub', {
'ttl': 30,
'type': 'CNAME',
'value': '_0123456789abcdef.acm-validations.aws.',
}),
'not-cname': Record.new(zone, '_deadbeef.not-cname', {
'ttl': 30,
'type': 'AAAA',
'value': '::1',
}),
'not-acm': Record.new(zone, '_not-acm', {
'ttl': 30,
'type': 'CNAME',
'value': 'localhost.unit.tests.',
}),
}
class TestAwsAcmMangingProcessor(TestCase):
def test_process_zones(self):
acm = AwsAcmMangingProcessor('acm')
source = Zone(zone.name, [])
# Unrelated stuff that should be untouched
source.add_record(records['not-cname'])
source.add_record(records['not-acm'])
# ACM records that should be ignored
source.add_record(records['root'])
source.add_record(records['sub'])
got = acm.process_source_zone(source)
self.assertEqual([
'_deadbeef.not-cname',
'_not-acm',
], sorted([r.name for r in got.records]))
existing = Zone(zone.name, [])
# Unrelated stuff that should be untouched
existing.add_record(records['not-cname'])
existing.add_record(records['not-acm'])
# Stuff that will be ignored
existing.add_record(records['root'])
existing.add_record(records['sub'])
got = acm.process_target_zone(existing)
self.assertEqual([
'_deadbeef.not-cname',
'_not-acm'
], sorted([r.name for r in got.records]))
def test_missing(self):
with self.assertRaises(ModuleNotFoundError):
from octodns.processor.awsacm import AwsAcmMangingProcessor
AwsAcmMangingProcessor

View File

File diff suppressed because it is too large Load Diff