refactor: use injected config sources for retention

Allow retention planning and pruning to use the same ConfigSource
abstraction as scheduled backups. This removes the remaining SQL-to-YAML
export dependency from Django backup runs with pruning, keeping YAML only
as a legacy CLI compatibility path.
This commit is contained in:
2026-05-19 05:00:15 +02:00
parent bb44f8a09c
commit 100215bf11
6 changed files with 74 additions and 16 deletions

View File

@@ -9,7 +9,6 @@ from django.utils import timezone
from pobsync.commands.run_scheduled import run_scheduled
from pobsync.paths import PobsyncPaths
from pobsync_backend.config_repository import export_runtime_configs
from pobsync_backend.config_source import DjangoConfigSource
from pobsync_backend.models import BackupRun, HostConfig
@@ -33,11 +32,6 @@ class Command(BaseCommand):
except HostConfig.DoesNotExist as exc:
raise CommandError(f"Missing enabled HostConfig {host_name!r}") from exc
# Compatibility bridge: retention planning still reads runtime YAML.
# The backup run itself receives config directly from Django.
if options["prune"]:
export_runtime_configs(prefix=paths.home, host=host.host)
run = BackupRun.objects.create(
host=host,
run_type=BackupRun.RunType.SCHEDULED,