diff options
author | Sujil02 <sushah@redhat.com> | 2020-04-08 04:49:32 -0400 |
---|---|---|
committer | Sujil02 <sushah@redhat.com> | 2020-04-15 11:17:33 -0400 |
commit | ec4060aef6c77c049fc2c3b6438ebb5590f6ab69 (patch) | |
tree | 2ce43bc8b0a0c0b9c9bdf1d404c6339e06441a6b /pkg/api/handlers | |
parent | 37ed662f323ef4700ae14d441fb2264a59960baa (diff) | |
download | podman-ec4060aef6c77c049fc2c3b6438ebb5590f6ab69.tar.gz podman-ec4060aef6c77c049fc2c3b6438ebb5590f6ab69.tar.bz2 podman-ec4060aef6c77c049fc2c3b6438ebb5590f6ab69.zip |
Ability to prune container in api V2
Adds ability to prune containers for v2.
Adds client side prompt with force flag and filters options to prune.
Signed-off-by: Sujil02 <sushah@redhat.com>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/compat/containers_prune.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/pkg/api/handlers/compat/containers_prune.go b/pkg/api/handlers/compat/containers_prune.go index a56c3903d..bf3aecd65 100644 --- a/pkg/api/handlers/compat/containers_prune.go +++ b/pkg/api/handlers/compat/containers_prune.go @@ -4,8 +4,8 @@ import ( "net/http" "github.com/containers/libpod/libpod" - "github.com/containers/libpod/pkg/api/handlers" "github.com/containers/libpod/pkg/api/handlers/utils" + "github.com/containers/libpod/pkg/domain/entities" "github.com/docker/docker/api/types" "github.com/gorilla/schema" "github.com/pkg/errors" @@ -40,14 +40,11 @@ func PruneContainers(w http.ResponseWriter, r *http.Request) { // Libpod response differs if utils.IsLibpodRequest(r) { - var response []handlers.LibpodContainersPruneReport - for ctrID, size := range prunedContainers { - response = append(response, handlers.LibpodContainersPruneReport{ID: ctrID, SpaceReclaimed: size}) + report := &entities.ContainerPruneReport{ + Err: pruneErrors, + ID: prunedContainers, } - for ctrID, err := range pruneErrors { - response = append(response, handlers.LibpodContainersPruneReport{ID: ctrID, PruneError: err.Error()}) - } - utils.WriteResponse(w, http.StatusOK, response) + utils.WriteResponse(w, http.StatusOK, report) return } for ctrID, size := range prunedContainers { |