Browse Source

Merge "Ignore dns domain NotFound when deleting record"

changes/75/568775/1
Zuul 4 years ago committed by Gerrit Code Review
parent
commit
60b4a3f13f
  1. 5
      heat/engine/clients/os/designate.py
  2. 18
      heat/tests/clients/test_designate_client.py

5
heat/engine/clients/os/designate.py

@ -97,7 +97,10 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
return self.client().records.update(record.domain_id, record)
def record_delete(self, **kwargs):
domain_id = self.get_domain_id(kwargs.pop('domain'))
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'))

18
heat/tests/clients/test_designate_client.py

@ -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…
Cancel
Save