Skip to content

Commit

Permalink
Fix activating backup retention config on startup (#134523)
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery authored and frenck committed Jan 3, 2025
1 parent f719a14 commit 316f93f
Show file tree
Hide file tree
Showing 2 changed files with 239 additions and 86 deletions.
6 changes: 6 additions & 0 deletions homeassistant/components/backup/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def __init__(self, hass: HomeAssistant, manager: BackupManager) -> None:
def load(self, stored_config: StoredBackupConfig) -> None:
"""Load config."""
self.data = BackupConfigData.from_dict(stored_config)
self.data.retention.apply(self._manager)
self.data.schedule.apply(self._manager)

async def update(
Expand Down Expand Up @@ -160,8 +161,13 @@ class RetentionConfig:
def apply(self, manager: BackupManager) -> None:
"""Apply backup retention configuration."""
if self.days is not None:
LOGGER.debug(
"Scheduling next automatic delete of backups older than %s in 1 day",
self.days,
)
self._schedule_next(manager)
else:
LOGGER.debug("Unscheduling next automatic delete")
self._unschedule_next(manager)

def to_dict(self) -> StoredRetentionConfig:
Expand Down
Loading

0 comments on commit 316f93f

Please # to comment.