Merge "Print tag and repo into ImageAlreadyExists"

This commit is contained in:
Jenkins 2016-11-03 15:00:44 +00:00 committed by Gerrit Code Review
commit 96b5fc1870
3 changed files with 4 additions and 2 deletions

View File

@ -346,7 +346,7 @@ class ContainerAlreadyExists(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):

View File

@ -279,7 +279,8 @@ class Connection(api.Connection):
try:
image.save()
except db_exc.DBDuplicateEntry:
raise exception.ImageAlreadyExists()
raise exception.ImageAlreadyExists(tag=values['tag'],
repo=values['repo'])
return image
def update_image(self, image_id, values):

View File

@ -118,6 +118,7 @@ class TestImageController(api_base.FunctionalTest):
for id_ in range(4):
test_image = utils.create_test_image(
id=id_,
repo='testrepo' + str(id_),
uuid=comm_utils.generate_uuid())
image_list.append(objects.Image(self.context, **test_image))
mock_image_list.return_value = image_list[-1:]