From 89a9750b6dd55b6d647d43942c6f97c9e1bb4029 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 16 Aug 2018 15:33:44 -0400 Subject: Don't fail on size. I think a created container which was never run will have no size struct we should just return 0 Signed-off-by: Daniel J Walsh Closes: #1288 Approved by: TomSweeneyRedHat --- cmd/podman/ps.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cmd/podman') diff --git a/cmd/podman/ps.go b/cmd/podman/ps.go index 0ad511217..3b53fe6f1 100644 --- a/cmd/podman/ps.go +++ b/cmd/podman/ps.go @@ -522,9 +522,10 @@ func getTemplateOutput(psParams []psJSONParams, opts shared.PsOptions) ([]psTemp } if opts.Size { if psParam.Size == nil { - return nil, errors.Errorf("Container %s does not have a size struct", psParam.ID) + size = units.HumanSizeWithPrecision(0, 0) + } else { + size = units.HumanSizeWithPrecision(float64(psParam.Size.RwSize), 3) + " (virtual " + units.HumanSizeWithPrecision(float64(psParam.Size.RootFsSize), 3) + ")" } - size = units.HumanSizeWithPrecision(float64(psParam.Size.RwSize), 3) + " (virtual " + units.HumanSizeWithPrecision(float64(psParam.Size.RootFsSize), 3) + ")" } if opts.Pod { pod = psParam.Pod -- cgit v1.2.3-54-g00ecf