diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-26 18:11:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-26 18:11:38 +0100 |
commit | 4f38509b6c8366e1093968833e2342b5b65311c5 (patch) | |
tree | 299b90de83112d133e56c85ee4c9d002aa29f056 /pkg/api/handlers/compat/images_remove.go | |
parent | 8cccac54979b804d1086ff42654de07dba802a2e (diff) | |
parent | f38a26bfa0621e06ad8401ded3e10d7ea834819e (diff) | |
download | podman-4f38509b6c8366e1093968833e2342b5b65311c5.tar.gz podman-4f38509b6c8366e1093968833e2342b5b65311c5.tar.bz2 podman-4f38509b6c8366e1093968833e2342b5b65311c5.zip |
Merge pull request #5615 from jwhonce/wip/images
V2 podman image rm | podman rmi [IMAGE]
Diffstat (limited to 'pkg/api/handlers/compat/images_remove.go')
-rw-r--r-- | pkg/api/handlers/compat/images_remove.go | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/pkg/api/handlers/compat/images_remove.go b/pkg/api/handlers/compat/images_remove.go index 3d346543e..ed0153529 100644 --- a/pkg/api/handlers/compat/images_remove.go +++ b/pkg/api/handlers/compat/images_remove.go @@ -36,17 +36,23 @@ func RemoveImage(w http.ResponseWriter, r *http.Request) { return } - _, err = runtime.RemoveImage(r.Context(), newImage, query.Force) + results, err := runtime.RemoveImage(r.Context(), newImage, query.Force) if err != nil { utils.Error(w, "Something went wrong.", http.StatusInternalServerError, err) return } - // TODO - // This will need to be fixed for proper response, like Deleted: and Untagged: - m := make(map[string]string) - m["Deleted"] = newImage.ID() - foo := []map[string]string{} - foo = append(foo, m) - utils.WriteResponse(w, http.StatusOK, foo) + + response := make([]map[string]string, 0, len(results.Untagged)+1) + deleted := make(map[string]string, 1) + deleted["Deleted"] = results.Deleted + response = append(response, deleted) + + for _, u := range results.Untagged { + untagged := make(map[string]string, 1) + untagged["Untagged"] = u + response = append(response, untagged) + } + + utils.WriteResponse(w, http.StatusOK, response) } |