-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the robustness of image cleanup #313
Conversation
That makes the name useless
There was a problem hiding this 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
Line 437 in 4a6e191
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.
src/rocker/core.py
Outdated
def docker_remove_image( | ||
image_id, | ||
docker_client = None, | ||
output_callback = None, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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.