refactor: send_datasets_to_backup_pool
This commit is contained in:
+27
-23
@@ -203,33 +203,37 @@ def main():
|
||||
backup_pool = find_backup_pool()
|
||||
import_pool(backup_pool)
|
||||
try:
|
||||
last_local_snapshot = last_snapshot(config.local_pool)
|
||||
if not last_local_snapshot:
|
||||
print("Es scheint keine Snapshots im Speicherpool zu geben")
|
||||
print("Breche ab.")
|
||||
export_pool(backup_pool)
|
||||
exit()
|
||||
last_remote_snapshot = last_snapshot(backup_pool)
|
||||
if not last_remote_snapshot:
|
||||
print("Es scheint keine Snapshots auf der Backup-Festplatte zu geben")
|
||||
print("Breche ab.")
|
||||
export_pool(backup_pool)
|
||||
exit()
|
||||
if not present_locally(last_remote_snapshot):
|
||||
print(
|
||||
"""
|
||||
Kann keine inkrementelle Sicherung durchführen, da es im Backup und auf dem Server
|
||||
keinen gemeinsamen Snapshot gibt. Vermutlich wurde diese externe Festplatte vor
|
||||
zu langer Zeit das letzte mal als Backup verwendet"""
|
||||
)
|
||||
return
|
||||
for dataset in datasets:
|
||||
do_backup(dataset, last_local_snapshot, last_remote_snapshot, backup_pool)
|
||||
clean_old_snapshots(dataset, backup_pool)
|
||||
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)
|
||||
if not last_local_snapshot:
|
||||
print("Es scheint keine Snapshots im Speicherpool zu geben")
|
||||
print("Breche ab.")
|
||||
export_pool(backup_pool)
|
||||
exit()
|
||||
last_remote_snapshot = last_snapshot(backup_pool)
|
||||
if not last_remote_snapshot:
|
||||
print("Es scheint keine Snapshots auf der Backup-Festplatte zu geben")
|
||||
print("Breche ab.")
|
||||
export_pool(backup_pool)
|
||||
exit()
|
||||
if not present_locally(last_remote_snapshot):
|
||||
print(
|
||||
"""
|
||||
Kann keine inkrementelle Sicherung durchführen, da es im Backup und auf dem Server
|
||||
keinen gemeinsamen Snapshot gibt. Vermutlich wurde diese externe Festplatte vor
|
||||
zu langer Zeit das letzte mal als Backup verwendet"""
|
||||
)
|
||||
return
|
||||
for dataset in datasets:
|
||||
do_backup(dataset, last_local_snapshot, last_remote_snapshot, backup_pool)
|
||||
clean_old_snapshots(dataset, backup_pool)
|
||||
|
||||
|
||||
def verify_running_as_root():
|
||||
if os.getuid() > 0:
|
||||
print("Muss als root ausgeführt werden.")
|
||||
|
||||
Reference in New Issue
Block a user