refactor: send_datasets_to_backup_pool
This commit is contained in:
+9
-5
@@ -203,6 +203,12 @@ def main():
|
|||||||
backup_pool = find_backup_pool()
|
backup_pool = find_backup_pool()
|
||||||
import_pool(backup_pool)
|
import_pool(backup_pool)
|
||||||
try:
|
try:
|
||||||
|
send_datasets_to_backup_pool(backup_pool, datasets)
|
||||||
|
finally:
|
||||||
|
export_pool(backup_pool)
|
||||||
|
|
||||||
|
|
||||||
|
def send_datasets_to_backup_pool(backup_pool, datasets):
|
||||||
last_local_snapshot = last_snapshot(config.local_pool)
|
last_local_snapshot = last_snapshot(config.local_pool)
|
||||||
if not last_local_snapshot:
|
if not last_local_snapshot:
|
||||||
print("Es scheint keine Snapshots im Speicherpool zu geben")
|
print("Es scheint keine Snapshots im Speicherpool zu geben")
|
||||||
@@ -218,16 +224,14 @@ def main():
|
|||||||
if not present_locally(last_remote_snapshot):
|
if not present_locally(last_remote_snapshot):
|
||||||
print(
|
print(
|
||||||
"""
|
"""
|
||||||
Kann keine inkrementelle Sicherung durchführen, da es im Backup und auf dem Server
|
Kann keine inkrementelle Sicherung durchführen, da es im Backup und auf dem Server
|
||||||
keinen gemeinsamen Snapshot gibt. Vermutlich wurde diese externe Festplatte vor
|
keinen gemeinsamen Snapshot gibt. Vermutlich wurde diese externe Festplatte vor
|
||||||
zu langer Zeit das letzte mal als Backup verwendet"""
|
zu langer Zeit das letzte mal als Backup verwendet"""
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
for dataset in datasets:
|
for dataset in datasets:
|
||||||
do_backup(dataset, last_local_snapshot, last_remote_snapshot, backup_pool)
|
do_backup(dataset, last_local_snapshot, last_remote_snapshot, backup_pool)
|
||||||
clean_old_snapshots(dataset, backup_pool)
|
clean_old_snapshots(dataset, backup_pool)
|
||||||
finally:
|
|
||||||
export_pool(backup_pool)
|
|
||||||
|
|
||||||
|
|
||||||
def verify_running_as_root():
|
def verify_running_as_root():
|
||||||
|
|||||||
Reference in New Issue
Block a user