diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2018-08-16 15:33:44 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-08-17 09:02:10 +0000 |
commit | 89a9750b6dd55b6d647d43942c6f97c9e1bb4029 (patch) | |
tree | a71f9dfd62c40cc8e405e51c2a6fab0650806cb8 | |
parent | cd73f77414586fed66c5d7d81d57448ff1f0b54e (diff) | |
download | podman-89a9750b6dd55b6d647d43942c6f97c9e1bb4029.tar.gz podman-89a9750b6dd55b6d647d43942c6f97c9e1bb4029.tar.bz2 podman-89a9750b6dd55b6d647d43942c6f97c9e1bb4029.zip |
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 <dwalsh@redhat.com>
Closes: #1288
Approved by: TomSweeneyRedHat
-rw-r--r-- | cmd/podman/ps.go | 5 |
1 files changed, 3 insertions, 2 deletions
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 |