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
This commit is contained in:
Stefan Agner 2023-11-11 13:41:56 +01:00 committed by GitHub
parent 5f4581042c
commit 16b71a22d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -360,18 +360,18 @@ class DockerAddon(DockerInterface):
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],
)
)

View File

@ -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