summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/zfssnap/zfssnap.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/zfssnap/zfssnap.py b/modules/zfssnap/zfssnap.py
index 46f1b2da..cb91564b 100644
--- a/modules/zfssnap/zfssnap.py
+++ b/modules/zfssnap/zfssnap.py
@@ -127,9 +127,7 @@ def prune(config, dry_run):
127 127
128 all_snaps = {snap['name'] for _, snaps in items.items() for snap in snaps} 128 all_snaps = {snap['name'] for _, snaps in items.items() for snap in snaps}
129 to_destroy = all_snaps - keep 129 to_destroy = all_snaps - keep
130 if to_destroy: 130 if not to_destroy:
131 logger.info(f'Will prune: %s', ', '.join(map(lambda snap: f'‘{snap}’', to_destroy)))
132 else:
133 logger.info('Nothing to prune') 131 logger.info('Nothing to prune')
134 132
135 for snap in to_destroy: 133 for snap in to_destroy:
@@ -139,6 +137,7 @@ def prune(config, dry_run):
139 args += [snap] 137 args += [snap]
140 _log_cmd(*args) 138 _log_cmd(*args)
141 subprocess.run(args, check=True) 139 subprocess.run(args, check=True)
140 logger.info(f'Pruned ‘{snap}’')
142 141
143def rename(snapshots, destroy=False): 142def rename(snapshots, destroy=False):
144 args = ['zfs', 'get', '-H', '-p', '-o', 'name,value', 'creation', *snapshots] 143 args = ['zfs', 'get', '-H', '-p', '-o', 'name,value', 'creation', *snapshots]