diff --git a/heat/common/exception.py b/heat/common/exception.py index 8796e102b2..54d3e121e0 100644 --- a/heat/common/exception.py +++ b/heat/common/exception.py @@ -231,8 +231,9 @@ class ImageNotFound(HeatException): msg_fmt = _("The Image (%(image_name)s) could not be found.") -class NoUniqueImageFound(HeatException): - msg_fmt = _("Multiple images were found with name (%(image_name)s).") +class PhysicalResourceNameAmbiguity(HeatException): + msg_fmt = _( + "Multiple physical resources were found with name (%(name)s).") class InvalidTenant(HeatException): diff --git a/heat/engine/resources/nova_utils.py b/heat/engine/resources/nova_utils.py index dbcaf4948e..946b8e3c1a 100644 --- a/heat/engine/resources/nova_utils.py +++ b/heat/engine/resources/nova_utils.py @@ -53,7 +53,7 @@ def get_image_id(nova_client, image_identifier): :param nova_client: the nova client to use :param image_identifier: image name or a UUID-like identifier :returns: the id of the requested :image_identifier: - :raises: exception.ImageNotFound, exception.NoUniqueImageFound + :raises: exception.ImageNotFound, exception.PhysicalResourceNameAmbiguity ''' image_id = None if uuidutils.is_uuid_like(image_identifier): @@ -79,7 +79,8 @@ def get_image_id(nova_client, image_identifier): elif len(image_names) > 1: logger.info("Mulitple images %s were found in glance with name" % image_identifier) - raise exception.NoUniqueImageFound(image_name=image_identifier) + raise exception.PhysicalResourceNameAmbiguity( + name=image_identifier) image_id = image_names.popitem()[0] return image_id diff --git a/heat/tests/test_instance.py b/heat/tests/test_instance.py index 9d3b296745..5faff11433 100644 --- a/heat/tests/test_instance.py +++ b/heat/tests/test_instance.py @@ -184,7 +184,8 @@ class InstancesTest(HeatTestCase): {'id': 4, 'name': 'CentOS 5.2'}]})) self.m.ReplayAll() - self.assertRaises(exception.NoUniqueImageFound, instance.handle_create) + self.assertRaises(exception.PhysicalResourceNameAmbiguity, + instance.handle_create) self.m.VerifyAll() diff --git a/heat/tests/test_server.py b/heat/tests/test_server.py index fb54683f34..4a62235325 100644 --- a/heat/tests/test_server.py +++ b/heat/tests/test_server.py @@ -222,7 +222,8 @@ class ServersTest(HeatTestCase): {'id': 4, 'name': 'CentOS 5.2'}]})) self.m.ReplayAll() - self.assertRaises(exception.NoUniqueImageFound, server.handle_create) + self.assertRaises(exception.PhysicalResourceNameAmbiguity, + server.handle_create) self.m.VerifyAll() diff --git a/heat/tests/test_validate.py b/heat/tests/test_validate.py index edf8d43b1b..6369a235d3 100644 --- a/heat/tests/test_validate.py +++ b/heat/tests/test_validate.py @@ -763,7 +763,8 @@ class validateTest(HeatTestCase): self.m.ReplayAll() resource = stack['Instance'] - self.assertRaises(exception.NoUniqueImageFound, resource.validate) + self.assertRaises(exception.PhysicalResourceNameAmbiguity, + resource.validate) self.m.VerifyAll()