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

Implement suggested changes

This commit is contained in:
Jonathan Leroy
2020-11-02 18:42:03 +01:00
parent 2d4855508c
commit bb7a1a43b7
2 changed files with 7 additions and 6 deletions

View File

@@ -231,6 +231,8 @@ class Manager(object):
sub_zones=self.configured_sub_zones(zone_name))
if desired:
# This is an alias zone, rather than populate it we'll copy the
# records over from `desired`.
for _, records in desired._records.items():
for record in records:
zone.add_record(record.copy(zone=zone), lenient=lenient)

View File

@@ -151,7 +151,6 @@ class Record(EqualityTupleMixin):
# force everything lower-case just to be safe
self.name = text_type(name).lower() if name else name
self.source = source
self._raw_data = data
self.ttl = int(data['ttl'])
self._octodns = data.get('octodns', {})
@@ -221,15 +220,15 @@ class Record(EqualityTupleMixin):
return Update(self, other)
def copy(self, zone=None):
_type = getattr(self, '_type')
if not self._raw_data.get('type'):
self._raw_data['type'] = _type
data = self.data
data['type'] = self._type
return Record.new(
zone if zone else self.zone,
self.name,
self._raw_data,
self.source
data,
self.source,
lenient=True
)
# NOTE: we're using __hash__ and ordering methods that consider Records