diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-11 13:33:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-11 13:33:36 -0500 |
commit | a500d939754f0d63342ec379ae4490f86bb72150 (patch) | |
tree | 08a1d0014901c3233d5721c70de998d76538c03f /cmd/podman | |
parent | afe4ce6b1ce6a5ba21472f51defd243bdd7750b3 (diff) | |
parent | 5f999b6bcda79538cb1033503acd4c25615bd43b (diff) | |
download | podman-a500d939754f0d63342ec379ae4490f86bb72150.tar.gz podman-a500d939754f0d63342ec379ae4490f86bb72150.tar.bz2 podman-a500d939754f0d63342ec379ae4490f86bb72150.zip |
Merge pull request #9320 from baude/issue9315
container ps json format miscue
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/containers/ps.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index 31f44d92f..c9dda4db6 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -142,11 +142,19 @@ func checkFlags(c *cobra.Command) error { } func jsonOut(responses []entities.ListContainer) error { - r := make([]entities.ListContainer, 0) + type jsonFormat struct { + entities.ListContainer + Created int64 + } + r := make([]jsonFormat, 0) for _, con := range responses { con.CreatedAt = units.HumanDuration(time.Since(con.Created)) + " ago" con.Status = psReporter{con}.Status() - r = append(r, con) + jf := jsonFormat{ + ListContainer: con, + Created: con.Created.UnixNano(), + } + r = append(r, jf) } b, err := json.MarshalIndent(r, "", " ") if err != nil { |