diff options
author | baude <bbaude@redhat.com> | 2021-02-11 09:23:49 -0600 |
---|---|---|
committer | baude <bbaude@redhat.com> | 2021-02-12 15:04:30 -0600 |
commit | aa353f77056bcc530074a259243993555da103fa (patch) | |
tree | 4f9c83480e9334eff1909c5ec87c97b3cd7bfea5 /cmd | |
parent | e70e3d514589ff8de293cb15876485d51a5dd6aa (diff) | |
download | podman-aa353f77056bcc530074a259243993555da103fa.tar.gz podman-aa353f77056bcc530074a259243993555da103fa.tar.bz2 podman-aa353f77056bcc530074a259243993555da103fa.zip |
container ps json format miscue
when printing out json format, we mistakenly changed the Created field
output to be a time.time in a different commit. This allows for
override of the Created field to be a unix ts as type int64.
Fixes: #9315
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'cmd')
-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 0b5bd22fc..c8b704038 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 { |