Fix stack delete error with none cluster

Before stack delete, I delete cluster first, and then stack
delete failed.

Change-Id: I523575668e5f52728116c68761aa221cb27fa132
Story: #2002623
Task: 22253
This commit is contained in:
liyi 2018-06-20 13:20:48 +08:00
parent a4a6a00809
commit 28003004d8
2 changed files with 14 additions and 5 deletions

View File

@ -67,7 +67,7 @@ class OpenStackSDKPlugin(client_plugin.ClientPlugin):
return interfaces
def is_not_found(self, ex):
return isinstance(ex, exceptions.ResourceNotFound)
return isinstance(ex, exceptions.NotFoundException)
def find_network_segment(self, value):
return self.client().network.find_segment(value).id

View File

@ -21,14 +21,23 @@ from heat.tests import utils
class OpenStackSDKPluginTest(common.HeatTestCase):
@mock.patch('openstack.connection.Connection')
def test_create(self, mock_connection):
def setUp(self, mock_connection):
super(OpenStackSDKPluginTest, self).setUp()
context = utils.dummy_context()
plugin = context.clients.client_plugin('openstack')
client = plugin.client()
self.plugin = context.clients.client_plugin('openstack')
def test_create(self):
client = self.plugin.client()
self.assertIsNotNone(client.network.segments)
def test_is_not_found(self):
self.assertFalse(self.plugin.is_not_found(
exceptions.HttpException(http_status=400)))
self.assertFalse(self.plugin.is_not_found(Exception))
self.assertTrue(self.plugin.is_not_found(
exceptions.NotFoundException(http_status=404)))
class SegmentConstraintTest(common.HeatTestCase):