Use EntityNotFound instead of PhysicalResourceNotFound

Replace and remove PhysicalResourceNotFound.

Change-Id: Ie1593c3877d05ffcad34be7700e0bbf503221b38
Partial-Bug: #1515603
This commit is contained in:
ricolin 2015-11-13 00:15:05 +08:00
parent f3556594b7
commit 78f68e095f
9 changed files with 9 additions and 16 deletions

View File

@ -288,7 +288,6 @@ def map_remote_error(ex):
'ResourceActionNotSupported',
'ResourceNotFound',
'ResourceNotAvailable',
'PhysicalResourceNotFound',
'WatchRuleNotFound',
'StackValidationFailed',
'InvalidSchemaError',

View File

@ -62,7 +62,6 @@ class FaultWrapper(wsgi.Middleware):
'ResourceNotFound': webob.exc.HTTPNotFound,
'SnapshotNotFound': webob.exc.HTTPNotFound,
'ResourceNotAvailable': webob.exc.HTTPNotFound,
'PhysicalResourceNotFound': webob.exc.HTTPNotFound,
'PhysicalResourceNameAmbiguity': webob.exc.HTTPBadRequest,
'InvalidTenant': webob.exc.HTTPForbidden,
'Forbidden': webob.exc.HTTPForbidden,

View File

@ -225,10 +225,6 @@ class ResourceNotAvailable(HeatException):
msg_fmt = _("The Resource (%(resource_name)s) is not available.")
class PhysicalResourceNotFound(HeatException):
msg_fmt = _("The Resource (%(resource_id)s) could not be found.")
class WatchRuleNotFound(HeatException):
msg_fmt = _("The Watch Rule (%(watch_name)s) could not be found.")

View File

@ -122,7 +122,7 @@ class NeutronClientPlugin(client_plugin.ClientPlugin):
same_name_groups = [g for g in all_groups if g['name'] == sg]
groups = [g['id'] for g in same_name_groups]
if len(groups) == 0:
raise exception.PhysicalResourceNotFound(resource_id=sg)
raise exception.EntityNotFound(entity='Resource', name=sg)
elif len(groups) == 1:
seclist.append(groups[0])
else:

View File

@ -150,7 +150,7 @@ class NeutronResource(resource.Resource):
same_name_groups = [g for g in all_groups if g['name'] == sg]
groups = [g['id'] for g in same_name_groups]
if len(groups) == 0:
raise exception.PhysicalResourceNotFound(resource_id=sg)
raise exception.EntityNotFound(entity='Resource', name=sg)
elif len(groups) == 1:
seclist.append(groups[0])
else:

View File

@ -1430,8 +1430,8 @@ class EngineService(service.Service):
cnxt,
physical_resource_id)
if not rs:
raise exception.PhysicalResourceNotFound(
resource_id=physical_resource_id)
raise exception.EntityNotFound(entity='Resource',
name=physical_resource_id)
stack = parser.Stack.load(cnxt, stack_id=rs.stack.id)
resource = stack[rs.name]

View File

@ -1557,8 +1557,7 @@ class CfnStackControllerTest(common.HeatTestCase):
dummy_req.context,
('find_physical_resource',
{'physical_resource_id': 'aaaaaaaa-9f88-404d-cccc-ffffffffffff'})
).AndRaise(heat_exception.PhysicalResourceNotFound(
resource_id='1'))
).AndRaise(heat_exception.EntityNotFound(entity='Resource', name='1'))
self.m.ReplayAll()

View File

@ -1368,20 +1368,20 @@ class InstancesTest(common.HeatTestCase):
instance,
security_groups,
sg='zero',
get_secgroup_raises=exception.PhysicalResourceNotFound)
get_secgroup_raises=exception.EntityNotFound)
security_groups = ['wrong_group_name',
'0389f747-7785-4757-b7bb-2ab07e4b09c3']
self._test_security_groups(
instance,
security_groups,
get_secgroup_raises=exception.PhysicalResourceNotFound)
get_secgroup_raises=exception.EntityNotFound)
security_groups = ['wrong_group_name', 'security_group_1']
self._test_security_groups(
instance,
security_groups,
get_secgroup_raises=exception.PhysicalResourceNotFound)
get_secgroup_raises=exception.EntityNotFound)
security_groups = ['duplicate_group_name', 'security_group_1']
self._test_security_groups(

View File

@ -211,7 +211,7 @@ class StackResourcesServiceTest(common.HeatTestCase):
ex = self.assertRaises(dispatcher.ExpectedException,
self.eng.find_physical_resource,
self.ctx, 'foo')
self.assertEqual(exception.PhysicalResourceNotFound, ex.exc_info[0])
self.assertEqual(exception.EntityNotFound, ex.exc_info[0])
@mock.patch.object(stack.Stack, 'load')
@tools.stack_context('service_resources_list_test_stack')