small refactor

This commit is contained in:
timeshifter
2022-12-06 14:29:15 +01:00
parent da6d6f1cc4
commit 891f6f3eec
+7 -4
View File
@@ -99,7 +99,7 @@ class Manager:
def _send_incremental( def _send_incremental(
self, local_dataset: Dataset, remote_dataset: Dataset self, local_dataset: Dataset, remote_dataset: Dataset
) -> Popen | None: ) -> Popen | None:
"""Send incremental stream between two datasets to remote.""" """Send incremental stream between two datasets to remote, return the pipe. If local and remote snapshot are identical, perform nothing and return None."""
start_snapshot = self._get_newest_common_snapshot_with_backup_tags( start_snapshot = self._get_newest_common_snapshot_with_backup_tags(
local_dataset, remote_dataset local_dataset, remote_dataset
) )
@@ -118,8 +118,7 @@ class Manager:
"""From all snapshots in the dataset, get the newest one that matches the backup tags in the config.""" """From all snapshots in the dataset, get the newest one that matches the backup tags in the config."""
snapshots = self._find_snapshots_with_backup_tag(dataset) snapshots = self._find_snapshots_with_backup_tag(dataset)
snapshots.sort() snapshots.sort()
end_snapshot = snapshots[-1] return snapshots[-1]
return end_snapshot
@property @property
def _datasets_to_backup(self) -> list[Dataset]: def _datasets_to_backup(self) -> list[Dataset]:
@@ -848,4 +847,8 @@ def _verify_running_as_root() -> None:
if __name__ == "__main__": if __name__ == "__main__":
main() try:
main()
except Exception as e:
print(e)
exit(EXIT_ERROR)