diff --git a/octodns/record/change.py b/octodns/record/change.py index ec9889c..83393e9 100644 --- a/octodns/record/change.py +++ b/octodns/record/change.py @@ -27,7 +27,11 @@ class Create(Change): @property def data(self): - return {'type': 'create', 'new': self.new.data} + return { + 'type': 'create', + 'new': self.new.data, + 'record_type': self.new._type, + } def __repr__(self, leader=''): source = self.new.source.id if self.new.source else '' @@ -43,6 +47,7 @@ class Update(Change): 'type': 'update', 'existing': self.existing.data, 'new': self.new.data, + 'record_type': self.new._type, } # Leader is just to allow us to work around heven eating leading whitespace @@ -65,7 +70,11 @@ class Delete(Change): @property def data(self): - return {'type': 'delete', 'existing': self.existing.data} + return { + 'type': 'delete', + 'existing': self.existing.data, + 'record_type': self.existing._type, + } def __repr__(self, leader=''): return f'Delete {self.existing}' diff --git a/tests/test_octodns_plan.py b/tests/test_octodns_plan.py index 21240a0..943d4af 100644 --- a/tests/test_octodns_plan.py +++ b/tests/test_octodns_plan.py @@ -407,18 +407,25 @@ class TestPlanSafety(TestCase): # we'll test the change .data's here while we're at it since they don't # have a dedicated test (file) delete_data = data['changes'][0] # delete - self.assertEqual(['existing', 'type'], sorted(delete_data.keys())) + self.assertEqual( + ['existing', 'record_type', 'type'], sorted(delete_data.keys()) + ) self.assertEqual('delete', delete_data['type']) + self.assertEqual('A', delete_data['record_type']) self.assertEqual(delete.existing.data, delete_data['existing']) create_data = data['changes'][1] # create - self.assertEqual(['new', 'type'], sorted(create_data.keys())) + self.assertEqual( + ['new', 'record_type', 'type'], sorted(create_data.keys()) + ) self.assertEqual('create', create_data['type']) + self.assertEqual('CNAME', create_data['record_type']) self.assertEqual(create.new.data, create_data['new']) update_data = data['changes'][3] # update self.assertEqual( - ['existing', 'new', 'type'], sorted(update_data.keys()) + ['existing', 'new', 'record_type', 'type'], + sorted(update_data.keys()), ) self.assertEqual('update', update_data['type']) self.assertEqual(update.existing.data, update_data['existing'])