diff --git a/heat/common/exception.py b/heat/common/exception.py index cc3f432fe..d1e6181eb 100644 --- a/heat/common/exception.py +++ b/heat/common/exception.py @@ -403,10 +403,6 @@ class EventSendFailed(HeatException): "on other engine (%(engine_id)s)") -class ServiceNotFound(HeatException): - msg_fmt = _("Service %(service_id)s not found") - - class UnsupportedObjectError(HeatException): msg_fmt = _('Unsupported object type %(objtype)s') diff --git a/heat/db/sqlalchemy/api.py b/heat/db/sqlalchemy/api.py index cd7eb9592..0a063d77d 100644 --- a/heat/db/sqlalchemy/api.py +++ b/heat/db/sqlalchemy/api.py @@ -1020,7 +1020,7 @@ def service_delete(context, service_id, soft_delete=True): def service_get(context, service_id): result = model_query(context, models.Service).get(service_id) if result is None: - raise exception.ServiceNotFound(service_id=service_id) + raise exception.EntityNotFound(entity='Service', name=service_id) return result diff --git a/heat/tests/db/test_sqlalchemy_api.py b/heat/tests/db/test_sqlalchemy_api.py index 08db99cd4..b129e1558 100644 --- a/heat/tests/db/test_sqlalchemy_api.py +++ b/heat/tests/db/test_sqlalchemy_api.py @@ -2500,8 +2500,9 @@ class DBAPIServiceTest(common.HeatTestCase): # Delete db_api.service_delete(self.ctx, service.id, False) - self.assertRaises(exception.ServiceNotFound, db_api.service_get, - self.ctx, service.id) + ex = self.assertRaises(exception.EntityNotFound, db_api.service_get, + self.ctx, service.id) + self.assertEqual('Service', ex.kwargs.get('entity')) class DBAPIResourceUpdateTest(common.HeatTestCase):