bundles/zfs: introduce zfs-snapshot-backups, enable backups for nodes which need zfs-snapshot-backups
All checks were successful
bundlewrap/pipeline/head This commit looks good

This commit is contained in:
Franzi 2021-05-15 20:32:23 +02:00
parent 93e36156a0
commit 479b730be4
Signed by: kunsi
GPG key ID: 12E3D2136B818350
11 changed files with 96 additions and 18 deletions

View file

@ -1,5 +1,22 @@
from os.path import join
if node.has_bundle('zfs'):
wanted_paths = node.metadata.get('backups/paths', set())
snapshot_paths = node.metadata.get('zfs/filesystems_with_backup_snapshots', {})
backup_paths = set()
for path in wanted_paths:
path_found = False
for zfs_paths in snapshot_paths.values():
if path in zfs_paths:
backup_paths.add(f'/mnt/backup-snapshot{path}')
path_found = True
if not path_found:
backup_paths.add(path)
else:
backup_paths = node.metadata.get('backups/paths', set())
if node.metadata.get('backups/exclude_from_backups', False):
files['/etc/backup.priv'] = {
'delete': True,
@ -17,7 +34,7 @@ else:
'username': node.metadata['backup-client']['user-name'],
'server': server,
'port': port,
'paths': node.metadata.get('backups/paths', {}),
'paths': backup_paths,
},
'mode': '0700',
}