Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use isoformat for dates when producing json output in cloud commands #1029

Merged
merged 2 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions tests/test_barman_cloud_backup_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def test_cloud_backup_show_json(
assert json.loads(out)["main"] == {
"backup_label": None,
"begin_offset": 40,
"begin_time": "Tue Jan 19 03:14:08 2038",
"begin_time": "2038-01-19T03:14:08",
"begin_wal": "000000010000000000000002",
"begin_xlog": "0/2000028",
"children_backup_ids": None,
Expand All @@ -176,7 +176,7 @@ def test_cloud_backup_show_json(
"data_checksums": "on",
"deduplicated_size": 1024,
"end_offset": 184,
"end_time": "Tue Jan 19 04:14:08 2038",
"end_time": "2038-01-19T04:14:08",
"end_wal": "000000010000000000000004",
"end_xlog": "0/20000B8",
"error": None,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@
"deduplicated_size": 1024,
"version": 90302,
"ident_file": "/pgdata/location/pg_ident.conf",
"end_time": "Wed Jul 23 12:00:43 2014",
"end_time": "2014-07-23T12:00:43",
"status": "DONE",
"backup_id": "1234567890",
"config_file": "/pgdata/location/postgresql.conf",
"timeline": 1,
"end_xlog": "0/20000B8",
"pgdata": "/pgdata/location",
"begin_time": "Wed Jul 23 11:00:43 2014",
"begin_time": "2014-07-23T11:00:43",
"hba_file": "/pgdata/location/pg_hba.conf",
"end_offset": 184,
"tablespaces": [
Expand Down
Loading