diff --git a/bundles/zfs/files/zfs-auto-snapshot b/bundles/zfs/files/zfs-auto-snapshot index 0a66311..a085ea3 100644 --- a/bundles/zfs/files/zfs-auto-snapshot +++ b/bundles/zfs/files/zfs-auto-snapshot @@ -31,14 +31,8 @@ label = argv[1] with open('/etc/zfs-snapshot-config.json', 'r') as fp: metadata = loads(fp.read()) -if 'snapshot_only' in metadata: - datasets = set(metadata['snapshot_only']) -else: - output = check_output(['zfs', 'list', '-H', '-o', 'name']).decode('UTF-8') - datasets = set(output.splitlines()) - -for pattern in metadata.get('snapshot_never', set()): - datasets = set(filter(lambda x: not re.search(pattern, x), datasets)) +output = check_output(['zfs', 'list', '-H', '-o', 'name']).decode('UTF-8') +datasets = set(output.splitlines()) default_retain = metadata['retain_defaults'][label] now = datetime.now().strftime('%F-%H%M') diff --git a/bundles/zfs/items.py b/bundles/zfs/items.py index 8ce2345..002665c 100644 --- a/bundles/zfs/items.py +++ b/bundles/zfs/items.py @@ -98,27 +98,3 @@ directories = { 'purge': True, }, } - -# TODO implement when we start managing backups via bundlewrap -#if node.metadata.get('zfs', {}).get('snapshots', {}).get('backup', {}).get('enabled', True): -# directories["/mnt/zfs-snapshot-backup"] = {} -# -# files["/usr/local/sbin/zfs-backup-snapshot"] = { -# 'content_type': 'mako', -# 'context': { -# # Set by our own metadata processor, guaranteed to exist. -# 'filesystems': node.metadata['zfs']['snapshots']['backup']['filesystems_with_snapshot'], -# }, -# 'mode': '0755', -# } -# files["/usr/local/sbin/zfs-backup-snapshot-unmount"] = { -# 'content_type': 'mako', -# 'context': { -# # Set by our own metadata processor, guaranteed to exist. -# 'filesystems': node.metadata['zfs']['snapshots']['backup']['filesystems_with_snapshot'], -# }, -# 'mode': '0755', -# } -# -#else: -# files["/mnt/zfs-snapshot-backup"] = {'delete': True} diff --git a/bundles/zfs/metadata.py b/bundles/zfs/metadata.py index 71495e1..53bf720 100644 --- a/bundles/zfs/metadata.py +++ b/bundles/zfs/metadata.py @@ -52,10 +52,6 @@ defaults = { 'datasets': {}, 'pools': {}, 'snapshots': { -# 'backup': { -# 'enabled': True, -# 'filesystems_with_snapshot': {}, -# }, 'retain_defaults': { 'hourly': 24, 'daily': 7, @@ -99,47 +95,6 @@ def zfs_scrub_cronjob(metadata): } -# TODO -#@metadata_reactor -#def zfs_snapshot_backup(metadata): -# if metadata.get('zfs/snapshots/backup/enabled'): -# # Collect all filesystems/datasets (e.g., "tank/mysql") which -# # are configured for (local) snapshots. For each of them, store -# # the mountpoint. This information will be used primarily by -# # "/usr/local/sbin/zfs-backup-snapshot", but may also be used by -# # other bundles (think backup tools). -# # -# # In other words, this API allows other bundles to check whether -# # a path belongs to a ZFS dataset with snapshots enabled. -# -# filesystems = {} -# -# if metadata.get('zfs/snapshots/snapshot_only', None) is not None: -# for name in metadata.get('zfs/snapshots/snapshot_only'): -# attrs = metadata.get('zfs/datasets')[name] -# if attrs.get('mountpoint') not in (None, "none"): -# filesystems[name] = attrs['mountpoint'] -# else: -# for name, attrs in metadata.get('zfs/datasets').items(): -# if attrs.get('mountpoint') not in (None, "none"): -# filesystems[name] = attrs['mountpoint'] -# -# for pattern in metadata.get('zfs/snapshots/snapshot_never', set()): -# filesystems = {k: v for k, v in filesystems.items() if not re.search(pattern, k)} -# -# return { -# 'zfs': { -# 'snapshots': { -# 'backup': { -# 'filesystems_with_snapshot': filesystems, -# }, -# }, -# }, -# } -# else: -# return {} - - @metadata_reactor def monitoring(metadata): if not node.has_bundle('sshmon'):