diff options
Diffstat (limited to 'modules/zfssnap/zfssnap.py')
-rw-r--r-- | modules/zfssnap/zfssnap.py | 13 |
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): |