summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2018-07-13 11:51:06 -0400
committerMatthew Heon <mheon@redhat.com>2018-07-13 14:28:41 -0400
commit5b43a6a7ee6638b6d6cdb129321e42ce0dce6975 (patch)
tree00ed69a91ab6be06c7f3b5a10b15f7ab252a00e5 /pkg/varlinkapi
parentf08fffa3061fd12763674138719f69290e143e3d (diff)
downloadpodman-5b43a6a7ee6638b6d6cdb129321e42ce0dce6975.tar.gz
podman-5b43a6a7ee6638b6d6cdb129321e42ce0dce6975.tar.bz2
podman-5b43a6a7ee6638b6d6cdb129321e42ce0dce6975.zip
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 <mheon@redhat.com>
Diffstat (limited to 'pkg/varlinkapi')
-rw-r--r--pkg/varlinkapi/util.go6
1 files changed, 4 insertions, 2 deletions
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
}