summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-02-19 18:40:29 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-02-19 18:40:29 +0100
commit08c5c0fd36d4a6beedea8b03a11f76acdf543521 (patch)
treef3338f4a43b5ecc584090a79eec6ffec7ede303b
parentaaf1329db505b567377f938214ae4df79e2f5990 (diff)
downloadnixos-08c5c0fd36d4a6beedea8b03a11f76acdf543521.tar
nixos-08c5c0fd36d4a6beedea8b03a11f76acdf543521.tar.gz
nixos-08c5c0fd36d4a6beedea8b03a11f76acdf543521.tar.bz2
nixos-08c5c0fd36d4a6beedea8b03a11f76acdf543521.tar.xz
nixos-08c5c0fd36d4a6beedea8b03a11f76acdf543521.zip
zfssnap: ...
-rw-r--r--modules/zfssnap/zfssnap.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/modules/zfssnap/zfssnap.py b/modules/zfssnap/zfssnap.py
index e90ed0db..ef125703 100644
--- a/modules/zfssnap/zfssnap.py
+++ b/modules/zfssnap/zfssnap.py
@@ -76,13 +76,12 @@ def prune(config, dry_run, keep_newest):
76 KeptBecause = namedtuple('KeptBecause', ['rule', 'ix', 'base', 'period']) 76 KeptBecause = namedtuple('KeptBecause', ['rule', 'ix', 'base', 'period'])
77 kept_because = OrderedDict(deque) 77 kept_because = OrderedDict(deque)
78 def keep_because(base, snap, rule, period=None): 78 def keep_because(base, snap, rule, period=None):
79 nonlocal kept_count 79 nonlocal KeptBecause, keep, kept_count, kept_because
80 if snap not in keep: 80 kept_count[rule][base] += 1
81 kept_count[rule][base] += 1 81 if snap not in kept_because:
82 if snap not in kept_because: 82 kept_because[snap] = deque()
83 kept_because[snap] = deque() 83 kept_because[snap].append(KeptBecause(rule=rule, ix=kept_count[rule][base], base=base, period=period))
84 kept_because[snap].append(KeptBecause(rule=rule, ix=kept_count[rule][base], base=base, period=period)) 84 keep.add(snap)
85 keep.add(snap)
86 85
87 within = config.gettimedelta('KEEP', 'within') 86 within = config.gettimedelta('KEEP', 'within')
88 if within > timedelta(seconds=0): 87 if within > timedelta(seconds=0):