mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-08-13 08:22:36 +01:00
* Check for local data before adding or updating a mount Adding a mount whose media/share directory already holds local data (e.g. Frigate recordings written before network storage was set up, or after systemd tore down the bind mount, see #7013) only failed at the bind-mount step: the data mount was already mounted and the mount registered in memory but never persisted, leaving a half-created mount until the next Supervisor restart. Updating an existing mount in that state even unmounted the working data mount first, just to fail on the non-empty bind target afterwards. Check the mount's target directories for local data upfront and fail the add/update before anything is touched. Paths that are already mount points are skipped since they get unmounted before reuse. If mounting still fails halfway (e.g. the bind mount unit fails to start), roll back by unmounting the new units instead of keeping the half-created mount in the list. Also pass the missing mount name argument to the debug log statement in create_mount. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Make mount target errors translatable Raise the mount target error conditions as dedicated exceptions with an error_key, message template and extra fields following the established pattern, so the frontend can localize them and show the mount name and path separately: - MountTargetNotEmptyError (mount_target_not_empty_error), raised both by the upfront local data check and the mount-time non-empty check - MountTargetNotDirectoryError (mount_target_not_directory_error) for a target path that exists but is not a directory Both remain subclasses of MountInvalidError so existing exception handling keeps working. Frontends without the translation strings fall back to the English message as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Raise not-a-directory error from upfront local data check The upfront check collapsed a target path that exists but is not a directory into MountTargetNotEmptyError. Distinguish the two conditions like the mount-time check does and raise MountTargetNotDirectoryError for the non-directory case. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>