Skip to content

Commit

Permalink
Use isoformat when producing json output in cloud-show-backup
Browse files Browse the repository at this point in the history
This is an hotfix for support ticket 40034

This patch modifies the `to_json()` method of the BackupInfo class
substituting the `ctime` method from the datetime class with the
`isoformat` method, when printing `begin_time` and `end_time`
in json format.

The new format preserves all the relevant informations of the datetime
object, including the timezone.

References: 40034

Signed-off-by: Giulio Calacoci <[email protected]>
  • Loading branch information
gcalacoci committed Oct 28, 2024
1 parent 01e7230 commit b1dd58f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions barman/infofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,9 +714,9 @@ def to_json(self):
if data.get("tablespaces") is not None:
data["tablespaces"] = [list(item) for item in data["tablespaces"]]
if data.get("begin_time") is not None:
data["begin_time"] = data["begin_time"].ctime()
data["begin_time"] = data["begin_time"].isoformat()
if data.get("end_time") is not None:
data["end_time"] = data["end_time"].ctime()
data["end_time"] = data["end_time"].isoformat()
return data

@classmethod
Expand Down

0 comments on commit b1dd58f

Please sign in to comment.