bundles/zfs: add option to disable snapshots for dataset tree
This commit is contained in:
parent
b40a8235d2
commit
b6eb12ed90
1 changed files with 9 additions and 2 deletions
|
@ -31,8 +31,15 @@ label = argv[1]
|
|||
with open('/etc/zfs-snapshot-config.json', 'r') as fp:
|
||||
metadata = loads(fp.read())
|
||||
|
||||
output = check_output(['zfs', 'list', '-H', '-o', 'name']).decode('UTF-8')
|
||||
datasets = set(output.splitlines())
|
||||
datasets = set()
|
||||
for line in check_output(['zfs', 'list', '-H', '-o', 'name']).splitlines():
|
||||
line = line.decode('UTF-8')
|
||||
|
||||
for prefix in metadata.get('snapshot_never', set()):
|
||||
if dataset.startswith(prefix):
|
||||
break
|
||||
else:
|
||||
datasets.add(line)
|
||||
|
||||
default_retain = metadata['retain_defaults'][label]
|
||||
now = datetime.now().strftime('%F-%H%M')
|
||||
|
|
Loading…
Reference in a new issue