diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-08 11:35:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 11:35:15 -0500 |
commit | 2bf13219f587d769400f26aeaed05930c34ce3d7 (patch) | |
tree | 131bf0b8c46d035de443d30b9c9aa5f641a9c19d /pkg/domain/infra/abi/images.go | |
parent | c32913d0a34def9fd3775ccf7dcef631942ee2b9 (diff) | |
parent | feecdf919f37d34033b58977e6af5c34bf26b6c4 (diff) | |
download | podman-2bf13219f587d769400f26aeaed05930c34ce3d7.tar.gz podman-2bf13219f587d769400f26aeaed05930c34ce3d7.tar.bz2 podman-2bf13219f587d769400f26aeaed05930c34ce3d7.zip |
Merge pull request #9266 from vrothberg/fix-6510
make `podman rmi` more robust
Diffstat (limited to 'pkg/domain/infra/abi/images.go')
-rw-r--r-- | pkg/domain/infra/abi/images.go | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 8ca93e770..f2d0f2c39 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -580,12 +580,21 @@ func (ir *ImageEngine) Remove(ctx context.Context, images []string, opts entitie // without having to pass all local data around. deleteImage := func(img *image.Image) error { results, err := ir.Libpod.RemoveImage(ctx, img, opts.Force) - if err != nil { + switch errors.Cause(err) { + case nil: + // Removal worked, so let's report it. + report.Deleted = append(report.Deleted, results.Deleted) + report.Untagged = append(report.Untagged, results.Untagged...) + return nil + case storage.ErrImageUnknown: + // The image must have been removed already (see #6510). + report.Deleted = append(report.Deleted, img.ID()) + report.Untagged = append(report.Untagged, img.ID()) + return nil + default: + // Fatal error. return err } - report.Deleted = append(report.Deleted, results.Deleted) - report.Untagged = append(report.Untagged, results.Untagged...) - return nil } // Delete all images from the local storage. |