mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-28 03:26:32 +00:00
Don't break startup with corrupt docker filesystem (#1936)
This commit is contained in:
parent
9e448b46ba
commit
d73c10f874
@ -7,7 +7,12 @@ import async_timeout
|
||||
|
||||
from .const import SOCKET_DBUS, SUPERVISED_SUPPORTED_OS, AddonStartup, CoreStates
|
||||
from .coresys import CoreSys, CoreSysAttributes
|
||||
from .exceptions import HassioError, HomeAssistantError, SupervisorUpdateError
|
||||
from .exceptions import (
|
||||
DockerAPIError,
|
||||
HassioError,
|
||||
HomeAssistantError,
|
||||
SupervisorUpdateError,
|
||||
)
|
||||
|
||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||
|
||||
@ -144,8 +149,11 @@ class Core(CoreSysAttributes):
|
||||
_LOGGER.error("Systemd DBUS is not connected")
|
||||
|
||||
# Check if image names from denylist exist
|
||||
if await self.sys_run_in_executor(self.sys_docker.check_denylist_images):
|
||||
self.coresys.supported = False
|
||||
try:
|
||||
if await self.sys_run_in_executor(self.sys_docker.check_denylist_images):
|
||||
self.coresys.supported = False
|
||||
self.healthy = False
|
||||
except DockerAPIError:
|
||||
self.healthy = False
|
||||
|
||||
async def start(self):
|
||||
|
@ -237,14 +237,19 @@ class DockerAPI:
|
||||
def check_denylist_images(self) -> bool:
|
||||
"""Return a boolean if the host has images in the denylist."""
|
||||
denied_images = set()
|
||||
for image in self.images.list():
|
||||
for tag in image.tags:
|
||||
image_name = tag.split(":")[0]
|
||||
if (
|
||||
image_name in DOCKER_IMAGE_DENYLIST
|
||||
and image_name not in denied_images
|
||||
):
|
||||
denied_images.add(image_name)
|
||||
|
||||
try:
|
||||
for image in self.images.list():
|
||||
for tag in image.tags:
|
||||
image_name = tag.split(":")[0]
|
||||
if (
|
||||
image_name in DOCKER_IMAGE_DENYLIST
|
||||
and image_name not in denied_images
|
||||
):
|
||||
denied_images.add(image_name)
|
||||
except (docker.errors.DockerException, requests.RequestException) as err:
|
||||
_LOGGER.error("Corrupt docker overlayfs detect: %s", err)
|
||||
raise DockerAPIError()
|
||||
|
||||
if not denied_images:
|
||||
return False
|
||||
|
Loading…
x
Reference in New Issue
Block a user