diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-04-15 13:42:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-15 13:42:36 -0700 |
commit | 6e9622aa987bba37026fe628bffb5958d4cf64cb (patch) | |
tree | 90389ebb3a7ba54080cec8c05bca4435f3e66bba /pkg/api | |
parent | 195cb11276d61311bbd2b5274ac7a98b62abaaba (diff) | |
parent | ec4060aef6c77c049fc2c3b6438ebb5590f6ab69 (diff) | |
download | podman-6e9622aa987bba37026fe628bffb5958d4cf64cb.tar.gz podman-6e9622aa987bba37026fe628bffb5958d4cf64cb.tar.bz2 podman-6e9622aa987bba37026fe628bffb5958d4cf64cb.zip |
Merge pull request #5775 from sujil02/v2-container-prune
Ability to prune container in api V2
Diffstat (limited to 'pkg/api')
-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 { |