Use EntityNotFound instead of ServerNotFound
This patch will use EntityNotFound instead of ServerNotFound. And will remove ServerNotFound exception class definition. Change-Id: I5a5aba82d57056893d5d7e644448cbd3de632ea5 Closes-Bug: #1461343
This commit is contained in:
parent
0ba3206b40
commit
232fe4ae02
|
@ -231,10 +231,6 @@ class EntityNotFound(HeatException):
|
|||
msg_fmt = _("The %(entity)s (%(name)s) could not be found.")
|
||||
|
||||
|
||||
class ServerNotFound(HeatException):
|
||||
msg_fmt = _("The server (%(server)s) could not be found.")
|
||||
|
||||
|
||||
class VolumeNotFound(HeatException):
|
||||
msg_fmt = _("The Volume (%(volume)s) could not be found.")
|
||||
|
||||
|
|
|
@ -425,7 +425,7 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
|||
except exceptions.NotFound as ex:
|
||||
LOG.warn(_LW('Server (%(server)s) not found: %(ex)s'),
|
||||
{'server': server, 'ex': ex})
|
||||
raise exception.ServerNotFound(server=server)
|
||||
raise exception.EntityNotFound(entity='Server', name=server)
|
||||
|
||||
def absolute_limits(self):
|
||||
"""Return the absolute limits as a dictionary."""
|
||||
|
@ -545,7 +545,7 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
|||
|
||||
class ServerConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
expected_exceptions = (exception.ServerNotFound,)
|
||||
expected_exceptions = (exception.EntityNotFound,)
|
||||
|
||||
def validate_with_client(self, client, server):
|
||||
client.client_plugin('nova').get_server(server)
|
||||
|
|
|
@ -132,10 +132,11 @@ class LaunchConfigurationTest(common.HeatTestCase):
|
|||
rsrc = stack['LaunchConfig']
|
||||
|
||||
self.patchobject(nova.NovaClientPlugin, 'get_server',
|
||||
side_effect=exception.ServerNotFound(server='5678'))
|
||||
side_effect=exception.EntityNotFound(
|
||||
entity='Server', name='5678'))
|
||||
msg = ("Property error : "
|
||||
"Resources.LaunchConfig.Properties.InstanceId: "
|
||||
"Error validating value '5678': The server (5678) "
|
||||
"Error validating value '5678': The Server (5678) "
|
||||
"could not be found.")
|
||||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
rsrc.validate)
|
||||
|
|
|
@ -183,8 +183,8 @@ class TestAutoScalingGroupValidation(common.HeatTestCase):
|
|||
mock_server.security_groups = [{u'name': u'hth_test'}]
|
||||
if not_found:
|
||||
self.patchobject(nova.NovaClientPlugin, 'get_server',
|
||||
side_effect=exception.ServerNotFound(
|
||||
server='5678'))
|
||||
side_effect=exception.EntityNotFound(
|
||||
entity='Server', name='5678'))
|
||||
else:
|
||||
self.patchobject(nova.NovaClientPlugin, 'get_server',
|
||||
return_value=mock_server)
|
||||
|
@ -222,7 +222,7 @@ class TestAutoScalingGroupValidation(common.HeatTestCase):
|
|||
self.m.ReplayAll()
|
||||
msg = ("Property error : "
|
||||
"Resources.WebServerGroup.Properties.InstanceId: "
|
||||
"Error validating value '5678': The server (5678) could "
|
||||
"Error validating value '5678': The Server (5678) could "
|
||||
"not be found.")
|
||||
exc = self.assertRaises(exception.StackValidationFailed,
|
||||
rsrc.validate)
|
||||
|
|
|
@ -103,7 +103,7 @@ class NovaClientPluginTests(NovaClientPluginTestCase):
|
|||
self.nova_client.servers.get.side_effect = [
|
||||
my_server, nova_exceptions.NotFound(404)]
|
||||
self.assertEqual(my_server, self.nova_plugin.get_server('my_server'))
|
||||
self.assertRaises(exception.ServerNotFound,
|
||||
self.assertRaises(exception.EntityNotFound,
|
||||
self.nova_plugin.get_server, 'idontexist')
|
||||
calls = [mock.call('my_server'),
|
||||
mock.call('idontexist')]
|
||||
|
@ -319,8 +319,8 @@ class ServerConstraintTest(common.HeatTestCase):
|
|||
self.assertTrue(self.constraint.validate("foo", self.ctx))
|
||||
|
||||
def test_validation_error(self):
|
||||
self.mock_get_server.side_effect = exception.ServerNotFound(
|
||||
server='bar')
|
||||
self.mock_get_server.side_effect = exception.EntityNotFound(
|
||||
entity='Server', name='bar')
|
||||
self.assertFalse(self.constraint.validate("bar", self.ctx))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue