From bb7a1a43b7e96cb03e712a3c7302292d5ccd72ce Mon Sep 17 00:00:00 2001 From: Jonathan Leroy Date: Mon, 2 Nov 2020 18:42:03 +0100 Subject: [PATCH] Implement suggested changes --- octodns/manager.py | 2 ++ octodns/record/__init__.py | 11 +++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/octodns/manager.py b/octodns/manager.py index 5f4af55..fc05810 100644 --- a/octodns/manager.py +++ b/octodns/manager.py @@ -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) diff --git a/octodns/record/__init__.py b/octodns/record/__init__.py index ae9ccb1..e065620 100644 --- a/octodns/record/__init__.py +++ b/octodns/record/__init__.py @@ -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