Rename exception NoUniqueImageFound
It is now called PhysicalResourceNameAmbiguity and can be used where looking up a physical resource by name results in more than one resource being returned. Change-Id: Ib6d03a4eac6dc674378b2f2619383d8d0f3dd25e
This commit is contained in:
parent
8e23e6819d
commit
2ae442f60b
|
@ -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):
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in New Issue