From 5b43a6a7ee6638b6d6cdb129321e42ce0dce6975 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 13 Jul 2018 11:51:06 -0400 Subject: Only print container size JSON if --size was requested To do this, move it into a separate struct, and embed that in the JSON we return. Signed-off-by: Matthew Heon --- pkg/varlinkapi/util.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkg/varlinkapi') diff --git a/pkg/varlinkapi/util.go b/pkg/varlinkapi/util.go index 25ab59801..ad5c8c19d 100644 --- a/pkg/varlinkapi/util.go +++ b/pkg/varlinkapi/util.go @@ -65,13 +65,15 @@ func makeListContainer(containerID string, batchInfo batchcontainer.BatchContain Runningfor: time.Since(batchInfo.ConConfig.CreatedTime).String(), Status: batchInfo.ConState.String(), Ports: ports, - Rootfssize: batchInfo.RootFsSize, - Rwsize: batchInfo.RwSize, Names: batchInfo.ConConfig.Name, Labels: batchInfo.ConConfig.Labels, Mounts: mounts, Containerrunning: batchInfo.ConState == libpod.ContainerStateRunning, Namespaces: namespace, } + if batchInfo.Size != nil { + lc.Rootfssize = batchInfo.Size.RootFsSize + lc.Rwsize = batchInfo.Size.RwSize + } return lc } -- cgit v1.2.3-54-g00ecf