Skip to content

Commit

Permalink
Write cluster info to backup.info
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewallace1979 committed Sep 14, 2023
1 parent 39b3f8b commit 74242f4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions barman/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,14 @@ def backup(self, wait=False, wait_timeout=None, name=None):
backup_name=name,
)
backup_info.set_attribute("systemid", self.server.systemid)
if hasattr(self.server.config, "cluster_primary"):
backup_info.set_attribute(
"cluster_primary", self.server.config.cluster_primary
)
if hasattr(self.server.config, "cluster_backup_source"):
backup_info.set_attribute(
"cluster_backup_source", self.server.config.cluster_backup_source
)

backup_info.save()
self.backup_cache_add(backup_info)
Expand Down
9 changes: 8 additions & 1 deletion barman/infofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,17 @@ class BackupInfo(FieldListFile):
snapshots_info = Field(
"snapshots_info", load=load_snapshots_info, dump=output_snapshots_info
)
cluster_primary = Field("cluster_primary")
cluster_backup_source = Field("cluster_backup_source")

__slots__ = "backup_id", "backup_version"

_hide_if_null = ("backup_name", "snapshots_info")
_hide_if_null = (
"backup_name",
"snapshots_info",
"cluster_primary",
"cluster_backup_source",
)

def __init__(self, backup_id, **kwargs):
"""
Expand Down

0 comments on commit 74242f4

Please sign in to comment.