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
This commit is contained in:
Daniel J Walsh
2018-08-16 15:33:44 -04:00
committed by Atomic Bot
parent cd73f77414
commit 89a9750b6d

View File

@ -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