mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-19 18:08:40 +00:00
Fix missing metadata of stopped add-ons after aiodocker migration (#6435)
After the aiodocker migration in #6415 some add-ons may have been missing IP addresses because the metadata was retrieved for the container before it was started and network initialized. This manifested as some containers being unreachable through ingress (e.g. 'Ingress error: Cannot connect to host 0.0.0.0:8099'), especially if they have been started manually after Supervisor startup. To fix it, simply move retrieval of the container metadata (which is then persisted in DockerInterface._meta) to the end of the run method, where all attributes should have correct values. This is similar to the flow before the refactoring, where Container.reload() was called to update the metadata.
This commit is contained in:
@@ -530,18 +530,6 @@ class DockerAPI(CoreSysAttributes):
|
||||
f"Dockerd connection issue for {name}: {err}", _LOGGER.error
|
||||
) from err
|
||||
|
||||
# Get container metadata
|
||||
try:
|
||||
container_attrs = await container.show()
|
||||
except aiodocker.DockerError as err:
|
||||
raise DockerAPIError(
|
||||
f"Can't inspect new container {name}: {err}", _LOGGER.error
|
||||
) from err
|
||||
except requests.RequestException as err:
|
||||
raise DockerRequestError(
|
||||
f"Dockerd connection issue for {name}: {err}", _LOGGER.error
|
||||
) from err
|
||||
|
||||
# Setup network and store container id in cidfile
|
||||
def setup_network_and_cidfile() -> None:
|
||||
# Write cidfile
|
||||
@@ -584,7 +572,18 @@ class DockerAPI(CoreSysAttributes):
|
||||
f"Dockerd connection issue for {name}: {err}", _LOGGER.error
|
||||
) from err
|
||||
|
||||
# Return metadata
|
||||
# Get container metadata after the container is started
|
||||
try:
|
||||
container_attrs = await container.show()
|
||||
except aiodocker.DockerError as err:
|
||||
raise DockerAPIError(
|
||||
f"Can't inspect started container {name}: {err}", _LOGGER.error
|
||||
) from err
|
||||
except requests.RequestException as err:
|
||||
raise DockerRequestError(
|
||||
f"Dockerd connection issue for {name}: {err}", _LOGGER.error
|
||||
) from err
|
||||
|
||||
return container_attrs
|
||||
|
||||
async def pull_image(
|
||||
|
||||
Reference in New Issue
Block a user