Backup: roots parameter
This commit is contained in:
@@ -161,11 +161,12 @@ class ResticStorage(Storage):
|
|||||||
|
|
||||||
|
|
||||||
class BackupManager:
|
class BackupManager:
|
||||||
def __init__(self, config: Config, storages: List[Storage]):
|
def __init__(self, config: Config, roots: List[Path], storages: List[Storage]):
|
||||||
self.errors: List[str] = []
|
self.errors: List[str] = []
|
||||||
self.warnings: List[str] = []
|
self.warnings: List[str] = []
|
||||||
self.successful_backups: List[str] = []
|
self.successful_backups: List[str] = []
|
||||||
self.config = config
|
self.config = config
|
||||||
|
self.roots: List[Path] = roots
|
||||||
self.storages = storages
|
self.storages = storages
|
||||||
|
|
||||||
def _select_telegram(self) -> Optional[TelegramConfig]:
|
def _select_telegram(self) -> Optional[TelegramConfig]:
|
||||||
@@ -176,7 +177,7 @@ class BackupManager:
|
|||||||
def find_applications(self) -> List[Application]:
|
def find_applications(self) -> List[Application]:
|
||||||
"""Get all application directories and their owners."""
|
"""Get all application directories and their owners."""
|
||||||
applications: List[Application] = []
|
applications: List[Application] = []
|
||||||
source_dirs = itertools.chain(*(root.iterdir() for root in self.config.roots))
|
source_dirs = itertools.chain(*(root.iterdir() for root in self.roots))
|
||||||
|
|
||||||
for app_dir in source_dirs:
|
for app_dir in source_dirs:
|
||||||
if "lost+found" in str(app_dir):
|
if "lost+found" in str(app_dir):
|
||||||
@@ -467,7 +468,7 @@ def initialize(config_path: Path) -> BackupManager:
|
|||||||
|
|
||||||
config = Config(roots=roots, notifications=notifications)
|
config = Config(roots=roots, notifications=notifications)
|
||||||
|
|
||||||
return BackupManager(config=config, storages=storages)
|
return BackupManager(config=config, roots=roots, storages=storages)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
Reference in New Issue
Block a user