summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat
diff options
context:
space:
mode:
authorJhon Honce <jhonce@redhat.com>2020-03-25 14:00:31 -0700
committerJhon Honce <jhonce@redhat.com>2020-03-25 17:54:14 -0700
commitf38a26bfa0621e06ad8401ded3e10d7ea834819e (patch)
treec43a0f48f6ce8e8a4e1105399c7ba77745bb3be8 /pkg/api/handlers/compat
parent36a4cc864d1de57cd822a81d01f0b5f1b40eaa7d (diff)
downloadpodman-f38a26bfa0621e06ad8401ded3e10d7ea834819e.tar.gz
podman-f38a26bfa0621e06ad8401ded3e10d7ea834819e.tar.bz2
podman-f38a26bfa0621e06ad8401ded3e10d7ea834819e.zip
V2 podman image rm | podman rmi [IMAGE]
* Add support for rm and rmi commands * Support for registry.ExitCode * Support for N-errors from domain layer * Add log-level support * Add syslog support Signed-off-by: Jhon Honce <jhonce@redhat.com>
Diffstat (limited to 'pkg/api/handlers/compat')
-rw-r--r--pkg/api/handlers/compat/images_remove.go22
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)
}