Compare commits

...

1 Commits

Author SHA1 Message Date
Stefan Agner
1955d83325 Don't log missing plugin containers as error when creating network
When the Supervisor network doesn't exist yet and gets created on fresh
startup, the plugin containers (observer, cli, dns, audio) legitimately
don't exist either. The subsequent attach_container_by_name calls are
wrapped in suppress(DockerError), but the DockerError constructor was
passed _LOGGER.error, producing noisy ERROR lines before the exception
was suppressed.

Convert 404 responses from docker.containers.get() into DockerNotFound
(a DockerError subclass) raised without logging, while keeping ERROR-
level logging for any other Docker API failures.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 10:08:14 +02:00

View File

@@ -24,7 +24,7 @@ from ..const import (
OBSERVER_DOCKER_NAME,
SUPERVISOR_DOCKER_NAME,
)
from ..exceptions import DockerError
from ..exceptions import DockerError, DockerNotFound
_LOGGER: logging.Logger = logging.getLogger(__name__)
@@ -290,6 +290,8 @@ class DockerNetwork:
try:
container = await self.docker.containers.get(name)
except aiodocker.DockerError as err:
if err.status == HTTPStatus.NOT_FOUND:
raise DockerNotFound(f"Can't find {name}") from err
raise DockerError(f"Can't find {name}: {err}", _LOGGER.error) from err
if container.id not in self.containers: