Merge "Print tag and repo into ImageAlreadyExists"
This commit is contained in:
commit
96b5fc1870
@ -346,7 +346,7 @@ class ContainerAlreadyExists(ResourceExists):
|
|||||||
|
|
||||||
|
|
||||||
class ImageAlreadyExists(ResourceExists):
|
class ImageAlreadyExists(ResourceExists):
|
||||||
message = _("An image with this tag and repo already exists.")
|
message = _("An image with tag %(tag)s and repo %(repo)s already exists.")
|
||||||
|
|
||||||
|
|
||||||
class InvalidStateException(ZunException):
|
class InvalidStateException(ZunException):
|
||||||
|
@ -279,7 +279,8 @@ class Connection(api.Connection):
|
|||||||
try:
|
try:
|
||||||
image.save()
|
image.save()
|
||||||
except db_exc.DBDuplicateEntry:
|
except db_exc.DBDuplicateEntry:
|
||||||
raise exception.ImageAlreadyExists()
|
raise exception.ImageAlreadyExists(tag=values['tag'],
|
||||||
|
repo=values['repo'])
|
||||||
return image
|
return image
|
||||||
|
|
||||||
def update_image(self, image_id, values):
|
def update_image(self, image_id, values):
|
||||||
|
@ -118,6 +118,7 @@ class TestImageController(api_base.FunctionalTest):
|
|||||||
for id_ in range(4):
|
for id_ in range(4):
|
||||||
test_image = utils.create_test_image(
|
test_image = utils.create_test_image(
|
||||||
id=id_,
|
id=id_,
|
||||||
|
repo='testrepo' + str(id_),
|
||||||
uuid=comm_utils.generate_uuid())
|
uuid=comm_utils.generate_uuid())
|
||||||
image_list.append(objects.Image(self.context, **test_image))
|
image_list.append(objects.Image(self.context, **test_image))
|
||||||
mock_image_list.return_value = image_list[-1:]
|
mock_image_list.return_value = image_list[-1:]
|
||||||
|
Loading…
Reference in New Issue
Block a user