diff options
author | Steve Taylor <steven@taylormuff.co.uk> | 2020-03-06 12:12:17 +0000 |
---|---|---|
committer | Steve Taylor <steven@taylormuff.co.uk> | 2020-03-06 13:17:56 +0000 |
commit | 920d09c1740547558c64315c0c2a826fc8294bda (patch) | |
tree | e56e3d3964829e6d0615984bfd5789f769c753de /pkg/api/handlers | |
parent | 83e52cf787eead5434a982230f0fdc8b4f3a10df (diff) | |
download | podman-920d09c1740547558c64315c0c2a826fc8294bda.tar.gz podman-920d09c1740547558c64315c0c2a826fc8294bda.tar.bz2 podman-920d09c1740547558c64315c0c2a826fc8294bda.zip |
Removed the unnecessary code
removed defaulting of query.Size
amended types.LibpodToContainer, removed hard coded true from inspect call
Signed-off-by: Steve Taylor <steven@taylormuff.co.uk>
Diffstat (limited to 'pkg/api/handlers')
-rw-r--r-- | pkg/api/handlers/generic/containers.go | 6 | ||||
-rw-r--r-- | pkg/api/handlers/types.go | 23 |
2 files changed, 3 insertions, 26 deletions
diff --git a/pkg/api/handlers/generic/containers.go b/pkg/api/handlers/generic/containers.go index 24b0ecb77..b8460702c 100644 --- a/pkg/api/handlers/generic/containers.go +++ b/pkg/api/handlers/generic/containers.go @@ -58,9 +58,6 @@ func ListContainers(w http.ResponseWriter, r *http.Request) { // override any golang type defaults } - // Default Size to false - query.Size = false - if err := decoder.Decode(&query, r.URL.Query()); err != nil { utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String())) return @@ -108,9 +105,6 @@ func GetContainer(w http.ResponseWriter, r *http.Request) { // override any golang type defaults } - // Default Size to false - query.Size = false - if err := decoder.Decode(&query, r.URL.Query()); err != nil { utils.Error(w, "Something went wrong.", http.StatusBadRequest, errors.Wrapf(err, "Failed to parse parameters for %s", r.URL.String())) return diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go index c5a5d1088..d3e92042f 100644 --- a/pkg/api/handlers/types.go +++ b/pkg/api/handlers/types.go @@ -403,13 +403,8 @@ func LibpodToContainer(l *libpod.Container, infoData []define.InfoData, sz bool) } func LibpodToContainerJSON(l *libpod.Container, sz bool) (*docker.ContainerJSON, error) { - var ( - sizeRootFs int64 - sizeRW int64 - ) - _, imageName := l.Image() - inspect, err := l.Inspect(true) + inspect, err := l.Inspect(sz) if err != nil { return nil, err } @@ -444,18 +439,6 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*docker.ContainerJSON, return nil, err } - if sz { - if sizeRW, err = l.RWSize(); err != nil { - return nil, err - } - if sizeRootFs, err = l.RootFsSize(); err != nil { - return nil, err - } - } else { - sizeRW = 0 - sizeRootFs = 0 - } - cb := docker.ContainerJSONBase{ ID: l.ID(), Created: l.CreatedTime().String(), @@ -478,8 +461,8 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*docker.ContainerJSON, ExecIDs: inspect.ExecIDs, HostConfig: &hc, GraphDriver: graphDriver, - SizeRw: &sizeRW, - SizeRootFs: &sizeRootFs, + SizeRw: inspect.SizeRw, + SizeRootFs: &inspect.SizeRootFs, } stopTimeout := int(l.StopTimeout()) |