Ignore dns domain NotFound when deleting record
when the domain is deleted, all its records are deleted as well. Not ignoring such NotFound can lead to undeletable stacks if they have a Designate::Record resource that references a deleted Designate Domain. Change-Id: If56f84b0b86f4d8136a1f83683a4a9eee5d89759 Closes-Bug: #1748953
This commit is contained in:
parent
fed80b7c9e
commit
55a7492c6c
|
@ -97,7 +97,10 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
|
|||
return self.client().records.update(record.domain_id, record)
|
||||
|
||||
def record_delete(self, **kwargs):
|
||||
try:
|
||||
domain_id = self.get_domain_id(kwargs.pop('domain'))
|
||||
except heat_exception.EntityNotFound:
|
||||
return
|
||||
return self.client().records.delete(domain_id,
|
||||
kwargs.pop('id'))
|
||||
|
||||
|
|
|
@ -283,6 +283,24 @@ class DesignateClientPluginRecordTest(common.HeatTestCase):
|
|||
self.sample_domain_id,
|
||||
self.sample_uuid)
|
||||
|
||||
@mock.patch.object(client.DesignateClientPlugin, 'client')
|
||||
@mock.patch('designateclient.v1.records.Record')
|
||||
def test_record_delete_domain_not_found(self, mock_record,
|
||||
client_designate):
|
||||
self._client.records.delete.return_value = None
|
||||
self.client_plugin.get_domain_id.side_effect = (
|
||||
heat_exception.EntityNotFound)
|
||||
client_designate.return_value = self._client
|
||||
|
||||
record = dict(
|
||||
id=self.sample_uuid,
|
||||
domain=self.sample_domain_id
|
||||
)
|
||||
|
||||
self.client_plugin.record_delete(**record)
|
||||
|
||||
self.assertFalse(self._client.records.delete.called)
|
||||
|
||||
@mock.patch.object(client.DesignateClientPlugin, 'client')
|
||||
@mock.patch('designateclient.v1.records.Record')
|
||||
def test_record_show(self, mock_record, client_designate):
|
||||
|
|
Loading…
Reference in New Issue