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
All checks were successful
bundlewrap/pipeline/head This commit looks good
This commit is contained in:
parent
93e36156a0
commit
479b730be4
11 changed files with 96 additions and 18 deletions
|
@ -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',
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue