From 16b71a22d1f2fe38f4b742fbf4d0e843aa751815 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Sat, 11 Nov 2023 13:41:56 +0100 Subject: [PATCH] Revert Home Assistant configuration to `/config` (#4697) * Revert Home Assistant configuration to `/config` With the new add-on config feature the intention is to provide a good location for add-on specific configurations. Currently, add-ons such as Node RED or ESPHome use the Home Assistant config directory because this location is accessible to the user (via Samba VSCode add-on etc.). To make it clear to add-on developer that the new intention is to use add-on specific config, the implementation now bind mounts the add-on configuration directory to `/config`. And since some add-ons still need access to the Home Assistant configuration, its config folder is mounted to `/homeassistant` under the new scheme. However, users do know the path `/config`, and edit things e.g. through the SSH or VS Code add-on. Also `/config` is still the directory from inside the Core container. For SSH/VS Code add-on we could work around using a symlink, but that only works as long as these add-ons don't have a add-on config themselfs. This all has very high confusion potential, for not much gain. The renaming is mainly "developer friendly", but not really user friendly. Let's minimize potential confusion, and keep things where they are. The Home Assistant config directory stays at `/config, in all cases, everwhere. Map the new add-on configuration directory to `/addon_config`. * Adjust tests/comments --- supervisor/docker/addon.py | 6 +++--- tests/docker/test_addon.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/supervisor/docker/addon.py b/supervisor/docker/addon.py index 79aa90fa48e..46f31867216 100644 --- a/supervisor/docker/addon.py +++ b/supervisor/docker/addon.py @@ -360,18 +360,18 @@ def mounts(self) -> list[Mount]: Mount( type=MountType.BIND, source=self.addon.path_extern_config.as_posix(), - target="/config", + target="/addon_config", read_only=addon_mapping[MAP_ADDON_CONFIG], ) ) - # Map Home Assistant config in new way + # Map Home Assistant config using the new mapping to /config still if MAP_HOMEASSISTANT_CONFIG in addon_mapping: mounts.append( Mount( type=MountType.BIND, source=self.sys_config.path_extern_homeassistant.as_posix(), - target="/homeassistant", + target="/config", read_only=addon_mapping[MAP_HOMEASSISTANT_CONFIG], ) ) diff --git a/tests/docker/test_addon.py b/tests/docker/test_addon.py index d2391114bac..d5edac5395a 100644 --- a/tests/docker/test_addon.py +++ b/tests/docker/test_addon.py @@ -149,12 +149,12 @@ def test_addon_map_homeassistant_folder( config["map"].append("homeassistant_config") docker_addon = get_docker_addon(coresys, addonsdata_system, config) - # Home Assistant config folder mounted to /homeassistant, not /config + # Home Assistant config folder still mounted to /config assert ( Mount( type="bind", source=coresys.config.path_extern_homeassistant.as_posix(), - target="/homeassistant", + target="/config", read_only=True, ) in docker_addon.mounts @@ -194,7 +194,7 @@ def test_addon_map_addon_config_folder( Mount( type="bind", source=docker_addon.addon.path_extern_config.as_posix(), - target="/config", + target="/addon_config", read_only=True, ) in docker_addon.mounts