Use EntityNotFound instead of NovaNetworkNotFound.
replace and remove NovaNetworkNotFound Change-Id: Iaf8fa96ebd68c305ac2ec7565ff54d7b43c45a09 Partial-Bug: #1515603
This commit is contained in:
parent
868b4616e9
commit
65d890174c
|
@ -189,10 +189,6 @@ class EntityNotFound(HeatException):
|
|||
msg_fmt = _("The %(entity)s (%(name)s) could not be found.")
|
||||
|
||||
|
||||
class NovaNetworkNotFound(HeatException):
|
||||
msg_fmt = _("The Nova network (%(network)s) could not be found.")
|
||||
|
||||
|
||||
class PhysicalResourceNameAmbiguity(HeatException):
|
||||
msg_fmt = _(
|
||||
"Multiple physical resources were found with name (%(name)s).")
|
||||
|
|
|
@ -23,7 +23,7 @@ from heat.engine import constraints
|
|||
class NetworkConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
expected_exceptions = (exceptions.NeutronClientException,
|
||||
exception.NovaNetworkNotFound,
|
||||
exception.EntityNotFound,
|
||||
exception.PhysicalResourceNameAmbiguity)
|
||||
|
||||
def validate_with_client(self, client, value):
|
||||
|
|
|
@ -573,7 +573,7 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
|||
except exceptions.NotFound as ex:
|
||||
LOG.debug('Nova network (%(net)s) not found: %(ex)s',
|
||||
{'net': label, 'ex': ex})
|
||||
raise exception.NovaNetworkNotFound(network=label)
|
||||
raise exception.EntityNotFound(entity='Nova network', name=label)
|
||||
except exceptions.NoUniqueMatch as exc:
|
||||
LOG.debug('Nova network (%(net)s) is not unique matched: %(exc)s',
|
||||
{'net': label, 'exc': exc})
|
||||
|
@ -692,7 +692,7 @@ class FlavorConstraint(constraints.BaseCustomConstraint):
|
|||
|
||||
class NetworkConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
expected_exceptions = (exception.NovaNetworkNotFound,
|
||||
expected_exceptions = (exception.EntityNotFound,
|
||||
exception.PhysicalResourceNameAmbiguity)
|
||||
|
||||
def validate_with_client(self, client, network):
|
||||
|
|
|
@ -895,7 +895,7 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
|
|||
for key in list(nets.keys()):
|
||||
try:
|
||||
net_id = self.client_plugin().get_net_id_by_label(key)
|
||||
except (exception.NovaNetworkNotFound,
|
||||
except (exception.EntityNotFound,
|
||||
exception.PhysicalResourceNameAmbiguity):
|
||||
net_id = None
|
||||
if net_id:
|
||||
|
|
|
@ -127,7 +127,7 @@ class NovaClientPluginTests(NovaClientPluginTestCase):
|
|||
self.nova_plugin.get_net_id_by_label('net_label'))
|
||||
|
||||
exc = self.assertRaises(
|
||||
exception.NovaNetworkNotFound,
|
||||
exception.EntityNotFound,
|
||||
self.nova_plugin.get_net_id_by_label, 'idontexist')
|
||||
expected = 'The Nova network (idontexist) could not be found'
|
||||
self.assertIn(expected, six.text_type(exc))
|
||||
|
@ -155,7 +155,7 @@ class NovaClientPluginTests(NovaClientPluginTestCase):
|
|||
self.assertEqual(net.id,
|
||||
self.nova_plugin.get_nova_network_id(net.id))
|
||||
exc = self.assertRaises(
|
||||
exception.NovaNetworkNotFound,
|
||||
exception.EntityNotFound,
|
||||
self.nova_plugin.get_nova_network_id, not_existent_net_id)
|
||||
expected = ('The Nova network (%s) could not be found' %
|
||||
not_existent_net_id)
|
||||
|
|
|
@ -2428,7 +2428,7 @@ class ServersTest(common.HeatTestCase):
|
|||
self.assertIn(expected, six.text_type(exc))
|
||||
expected = 'The Nova network (bar) could not be found'
|
||||
exc = self.assertRaises(
|
||||
exception.NovaNetworkNotFound,
|
||||
exception.EntityNotFound,
|
||||
server._build_nics, ([{'network': 'bar'}]))
|
||||
self.assertIn(expected, six.text_type(exc))
|
||||
|
||||
|
|
Loading…
Reference in New Issue