bundles/backup-server: improve
This commit is contained in:
parent
c905b7dc13
commit
a15740c899
2 changed files with 22 additions and 46 deletions
|
@ -15,16 +15,15 @@ for line in check_output('LC_ALL=C zfs list -H -t snapshot -o name', shell=True)
|
|||
line = line.decode('UTF-8')
|
||||
|
||||
if line.startswith('{}/'.format(server_settings['zfs-base'])):
|
||||
dataset, snapname = line.split('@', 1)
|
||||
try:
|
||||
dataset, snapname = line.split('@', 1)
|
||||
|
||||
dataset = dataset.split('/')[-1]
|
||||
ts, bucket = snapname.split('-', 1)
|
||||
dataset = dataset.split('/')[-1]
|
||||
ts, bucket = snapname.split('-', 1)
|
||||
|
||||
if not ts.isdigit():
|
||||
# garbage, ignore
|
||||
continue
|
||||
|
||||
snapshots[dataset].add(int(ts))
|
||||
snapshots[dataset].add(int(ts))
|
||||
except Exception as e:
|
||||
print(f"Exception while parsing snapshot name {line!r}: {e!r}")
|
||||
|
||||
backups = {}
|
||||
for dataset, snaps in snapshots.items():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue