diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-03-17 14:51:54 +0100 |
---|---|---|
committer | Valentin Rothberg <vrothberg@redhat.com> | 2022-03-19 10:05:43 +0100 |
commit | 95dad4d8a443682e59c14a94035a111bab3e42fc (patch) | |
tree | 33ca2ad0601038d36ee0c687367155450e2a1b56 /pkg/api/handlers/libpod/images.go | |
parent | c2eae35c606382418c6e2ce57c4ab874f1975f21 (diff) | |
download | podman-95dad4d8a443682e59c14a94035a111bab3e42fc.tar.gz podman-95dad4d8a443682e59c14a94035a111bab3e42fc.tar.bz2 podman-95dad4d8a443682e59c14a94035a111bab3e42fc.zip |
podman rmi --ignore
Add an `--ignore` flag to `podman image rm` to instruct ignoring image
if a specified image does not exist and to not throw an error. Other
commands (e.g., `podman container rm`) already support this flag.
Such an `--ignore` flag can come in handy in clean-up scripcts such as
the teardown phases in the Podman tests.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'pkg/api/handlers/libpod/images.go')
-rw-r--r-- | pkg/api/handlers/libpod/images.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/api/handlers/libpod/images.go b/pkg/api/handlers/libpod/images.go index eb9fb12a6..d59a83342 100644 --- a/pkg/api/handlers/libpod/images.go +++ b/pkg/api/handlers/libpod/images.go @@ -613,6 +613,7 @@ func ImagesBatchRemove(w http.ResponseWriter, r *http.Request) { query := struct { All bool `schema:"all"` Force bool `schema:"force"` + Ignore bool `schema:"ignore"` Images []string `schema:"images"` }{} @@ -621,7 +622,7 @@ func ImagesBatchRemove(w http.ResponseWriter, r *http.Request) { return } - opts := entities.ImageRemoveOptions{All: query.All, Force: query.Force} + opts := entities.ImageRemoveOptions{All: query.All, Force: query.Force, Ignore: query.Ignore} imageEngine := abi.ImageEngine{Libpod: runtime} rmReport, rmErrors := imageEngine.Remove(r.Context(), query.Images, opts) strErrs := errorhandling.ErrorsToStrings(rmErrors) |