Merge pull request #2247 from queue-tip/ecr-batch-delete-image-fix

Delete ECR image when it has no tags
This commit is contained in:
Steve Pulec 2019-07-01 21:09:52 -05:00 committed by GitHub
commit 176799637c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 59 additions and 17 deletions

View file

@ -403,7 +403,10 @@ class ECRBackend(BaseBackend):
image_found = True
repository.images[num].image_tag = image_id["imageTag"]
response["imageIds"].append(image.response_batch_delete_image)
repository.images[num].remove_tag(image_id["imageTag"])
if len(image.image_tags) > 1:
repository.images[num].remove_tag(image_id["imageTag"])
else:
repository.images.remove(image)
if not image_found:
failure_response = {