mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Merge pull request #830 from octodns/extract-route53
Extract Route53Provider and AwsAcmMangingProcessor into their own module
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
* [DnsimpleProvider](https://github.com/octodns/octodns-dnsimple/)
|
||||
* [Ns1Provider](https://github.com/octodns/octodns-ns1/)
|
||||
* [PowerDnsProvider](https://github.com/octodns/octodns-powerdns/)
|
||||
* [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.
|
||||
|
||||
@@ -212,7 +212,7 @@ The table below lists the providers octoDNS supports. We're currently in the pro
|
||||
| [OVH](/octodns/provider/ovh.py) | | ovh | A, AAAA, CAA, CNAME, MX, NAPTR, NS, PTR, SPF, SRV, SSHFP, TXT, DKIM | No | |
|
||||
| [PowerDnsProvider](https://github.com/octodns/octodns-powerdns/) | [octodns_powerdns](https://github.com/octodns/octodns-powerdns/) | | | | |
|
||||
| [Rackspace](/octodns/provider/rackspace.py) | | | A, AAAA, ALIAS, CNAME, MX, NS, PTR, SPF, TXT | No | |
|
||||
| [Route53](/octodns/provider/route53.py) | | boto3 | A, AAAA, CAA, CNAME, MX, NAPTR, NS, PTR, SPF, SRV, TXT | Both | CNAME health checks don't support a Host header |
|
||||
| [Route53](https://github.com/octodns/octodns-route53) | [octodns_route53](https://github.com/octodns/octodns-route53) | | | | |
|
||||
| [Selectel](/octodns/provider/selectel.py) | | | A, AAAA, CNAME, MX, NS, SPF, SRV, TXT | No | |
|
||||
| [Transip](/octodns/provider/transip.py) | | transip | A, AAAA, CNAME, MX, NS, SRV, SPF, TXT, SSHFP, CAA | No | |
|
||||
| [UltraDns](/octodns/provider/ultra.py) | | | A, AAAA, CAA, CNAME, MX, NS, PTR, SPF, SRV, TXT | No | |
|
||||
|
||||
+13
-35
@@ -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
|
||||
|
||||
+14
-1537
File diff suppressed because it is too large
Load Diff
@@ -3,8 +3,6 @@ azure-common==1.1.27
|
||||
azure-identity==1.5.0
|
||||
azure-mgmt-dns==8.0.0
|
||||
azure-mgmt-trafficmanager==0.51.0
|
||||
boto3==1.15.9
|
||||
botocore==1.18.9
|
||||
dnspython==1.16.0
|
||||
docutils==0.16
|
||||
dyn==1.8.1
|
||||
@@ -20,6 +18,5 @@ pycountry-convert==0.7.2
|
||||
pycountry==20.7.3
|
||||
python-dateutil==2.8.1
|
||||
requests==2.25.1
|
||||
s3transfer==0.3.3
|
||||
setuptools==44.1.1
|
||||
python-transip==0.5.0
|
||||
|
||||
@@ -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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user