bundles/backup-server: ignore all non-digit snapshots when rotating

This commit is contained in:
Franzi 2025-02-15 08:51:07 +01:00
parent a7a59fd690
commit 83730ccb6d
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -33,12 +33,11 @@ for line in check_output('LC_ALL=C zfs list -H -t snapshot -o name', shell=True)
if line.startswith('{}/{}@'.format(server_settings['zfs-base'], NODE)):
_, snapname = line.split('@', 1)
ts, bucket = snapname.split('-', 1)
if 'zfs-auto-snap' in snapname:
# migration from auto-snapshots, ignore
if not ts.isdigit():
continue
ts, bucket = snapname.split('-', 1)
buckets.setdefault(bucket, set()).add(int(ts))
syslog(f'classified {line} as {bucket} from {ts}')