cmd/kpod/ps.go: Use getCommand for JSON

The getCommand func strips out unwanted characters around the
command of the container.  The JSON output should use this func
like the regular ps output for both consistency and because
Python does a literal interpretation of the bracket [] characters
when consuming as JSON.

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude 2017-08-30 09:24:12 -05:00
parent 35eea14c66
commit 94602a1e85

View file

@ -298,7 +298,7 @@ func getJSONOutput(containers []*libkpod.ContainerData) (psOutput []psJSONParams
ID: ctr.ID, ID: ctr.ID,
Image: ctr.FromImage, Image: ctr.FromImage,
ImageID: ctr.FromImageID, ImageID: ctr.FromImageID,
Command: ctr.ImageCreatedBy, Command: getCommand(ctr.ImageCreatedBy),
CreatedAt: ctr.State.Created, CreatedAt: ctr.State.Created,
RunningFor: time.Since(ctr.State.Created), RunningFor: time.Since(ctr.State.Created),
Status: ctr.State.Status, Status: ctr.State.Status,