summaryrefslogtreecommitdiff
path: root/pkg/api/handlers/compat/containers_prune.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-15 13:42:36 -0700
committerGitHub <noreply@github.com>2020-04-15 13:42:36 -0700
commit6e9622aa987bba37026fe628bffb5958d4cf64cb (patch)
tree90389ebb3a7ba54080cec8c05bca4435f3e66bba /pkg/api/handlers/compat/containers_prune.go
parent195cb11276d61311bbd2b5274ac7a98b62abaaba (diff)
parentec4060aef6c77c049fc2c3b6438ebb5590f6ab69 (diff)
downloadpodman-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/handlers/compat/containers_prune.go')
-rw-r--r--pkg/api/handlers/compat/containers_prune.go13
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 {