From 17efc14c3698388ef12f3b2ce3b97402ca63d536 Mon Sep 17 00:00:00 2001 From: Michael Wallace Date: Thu, 14 Sep 2023 12:13:30 +0100 Subject: [PATCH] Include cluster info in show-backup output --- barman/output.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/barman/output.py b/barman/output.py index 85769815e..726bb0967 100644 --- a/barman/output.py +++ b/barman/output.py @@ -717,6 +717,18 @@ def render_show_backup_general(backup_info, output_fun, row): output_fun(row.format("Server Name", backup_info["server_name"])) if backup_info["systemid"]: output_fun(row.format("System Id", backup_info["systemid"])) + if ( + "cluster_primary" in backup_info + and backup_info["cluster_primary"] is not None + ): + output_fun(row.format("Primary", backup_info["cluster_primary"])) + if ( + "cluster_backup_source" in backup_info + and backup_info["cluster_backup_source"] is not None + ): + output_fun( + row.format("Backup source", backup_info["cluster_backup_source"]) + ) output_fun(row.format("Status", backup_info["status"])) if backup_info["status"] in BackupInfo.STATUS_COPY_DONE: output_fun(row.format("PostgreSQL Version", backup_info["version"])) @@ -1523,6 +1535,13 @@ def result_show_backup(self, backup_ext_info): output = self.json_output[server_name] = dict( backup_id=data["backup_id"], status=data["status"] ) + if "cluster_primary" in data and data["cluster_primary"] is not None: + output.update({"primary": data["cluster_primary"]}) + if ( + "cluster_backup_source" in data + and data["cluster_backup_source"] is not None + ): + output.update({"backup_source": data["cluster_backup_source"]}) if "backup_name" in data and data["backup_name"] is not None: output.update({"backup_name": data["backup_name"]})