diff --git a/heat/engine/clients/os/manila.py b/heat/engine/clients/os/manila.py index ed72a69c1..e281b712f 100644 --- a/heat/engine/clients/os/manila.py +++ b/heat/engine/clients/os/manila.py @@ -11,6 +11,7 @@ # License for the specific language governing permissions and limitations # under the License. +from heat.common import exception as heat_exception from heat.engine.clients import client_plugin from heat.engine import constraints from manilaclient import client as manila_client @@ -61,7 +62,7 @@ class ManilaClientPlugin(client_plugin.ClientPlugin): :param resource_list: list of resources :param resource_type_name: name of resource type that will be used for exceptions - :raises NotFound, NoUniqueMatch + :raises EntityNotFound, NoUniqueMatch :return: resource or generate an exception otherwise """ search_result_by_id = [res for res in resource_list @@ -81,10 +82,8 @@ class ManilaClientPlugin(client_plugin.ClientPlugin): elif match_count == 1: return search_result_by_name[0] else: - message = ("{0} '{1}' was not found in Manila. Please " - "use the identity of existing {0} in Heat " - "template.").format(resource_type_name, id_or_name) - raise exceptions.NotFound(message=message) + raise heat_exception.EntityNotFound(entity=resource_type_name, + name=id_or_name) def get_share_type(self, share_type_identity): return self._find_resource_by_id_or_name( @@ -119,7 +118,8 @@ class ManilaShareBaseConstraint(constraints.BaseCustomConstraint): # check that exceptions module has been loaded. Without this check # doc tests on gates will fail - expected_exceptions = (exceptions.NotFound, exceptions.NoUniqueMatch) + expected_exceptions = (heat_exception.EntityNotFound, + exceptions.NoUniqueMatch) resource_client_name = SERVICE_NAME diff --git a/heat/tests/clients/test_manila_client.py b/heat/tests/clients/test_manila_client.py index 30d8e7634..ca1f52e09 100644 --- a/heat/tests/clients/test_manila_client.py +++ b/heat/tests/clients/test_manila_client.py @@ -15,6 +15,7 @@ import collections from manilaclient import exceptions import mock +from heat.common import exception as heat_exception from heat.tests import common from heat.tests import utils @@ -66,6 +67,7 @@ class ManilaClientPluginTests(common.HeatTestCase): # test that get_ is searching correctly get_method = getattr(self.manila_plugin, self.method_name) self.assertEqual(get_method("unique_id").name, "unique_name") - self.assertRaises(exceptions.NotFound, get_method, "non_exist") + self.assertRaises(heat_exception.EntityNotFound, + get_method, "non_exist") self.assertRaises(exceptions.NoUniqueMatch, get_method, "duplicated_name")