From b37d6b87d24ec3b2668afa3c5e93e149c8758951 Mon Sep 17 00:00:00 2001 From: Giulio Calacoci Date: Wed, 28 Aug 2024 12:46:31 +0200 Subject: [PATCH] Use isoformat when producing json output in cloud-show-backup 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 --- barman/infofile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/barman/infofile.py b/barman/infofile.py index 15267390d..76fc76b47 100644 --- a/barman/infofile.py +++ b/barman/infofile.py @@ -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