Skip to content
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

Fix error detection case when image that is being deleted does not exist - continued. #2008

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/engine/docker_image_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ func (imageManager *dockerImageManager) deleteImage(ctx context.Context, imageID
seelog.Infof("Removing Image: %s", imageID)
err := imageManager.client.RemoveImage(ctx, imageID, dockerclient.RemoveImageTimeout)
if err != nil {
if strings.Contains(err.Error(), imageNotFoundForDeletionError) {
if strings.Contains(strings.ToLower(err.Error()), imageNotFoundForDeletionError) {
seelog.Errorf("Image already removed from the instance: %v", err)
} else {
seelog.Errorf("Error removing Image %v - %v", imageID, err)
Expand Down
2 changes: 1 addition & 1 deletion agent/engine/docker_image_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ func TestDeleteImageNotFoundError(t *testing.T) {
}
imageState, _ := imageManager.getImageState(imageInspected.ID)
client.EXPECT().RemoveImage(gomock.Any(), container.Image, dockerclient.RemoveImageTimeout).Return(
errors.New("no such image: " + container.Image))
errors.New("No such image: " + container.Image))
ctx, cancel := context.WithCancel(context.TODO())
defer cancel()
imageManager.deleteImage(ctx, container.Image, imageState)
Expand Down