Merge "Fix stack delete error with none cluster"

This commit is contained in:
Zuul 2018-07-12 06:31:00 +00:00 committed by Gerrit Code Review
commit 6e689a3620
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):