Skip to content

Conversation

@tfoote
Copy link
Collaborator

@tfoote tfoote commented Jan 25, 2025

Don't crash if there's a dependent image already
And don't cleanup if the user has given it a name. The name's useless if we clear it.

Copy link
Member

@nuclearsandwich nuclearsandwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised a concern about squelching the error but nothing blocking.

try:
docker_client.remove_image(image_id, force=force)
except docker.errors.APIError as ex:
## removing the image can fail if there's child images
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a little weird not to print or log a message when catching this error. The end-user has no way of knowing whether the image was cleaned up or not, especially with the default behavior of not failing on error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will return a True/False and then it warns the user based on the results:

print(f'Failed to clear image {self.image_id} it likely has child images.')

And the default is False so it's only suppressed if the developer asks for it to be suppressed.

def docker_remove_image(
image_id,
docker_client = None,
output_callback = None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind of drive-by but output_callback appears completely unused. Is it deprecated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this doesn't have the streaming interface so removing it makes sense.

As flagged in the review
@tfoote tfoote merged commit 149d4ef into main Feb 3, 2025
8 checks passed
@tfoote tfoote deleted the better_tag_detection_and_errors branch February 3, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants