mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-28 11:36: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 .const import SOCKET_DBUS, SUPERVISED_SUPPORTED_OS, AddonStartup, CoreStates
|
||||||
from .coresys import CoreSys, CoreSysAttributes
|
from .coresys import CoreSys, CoreSysAttributes
|
||||||
from .exceptions import HassioError, HomeAssistantError, SupervisorUpdateError
|
from .exceptions import (
|
||||||
|
DockerAPIError,
|
||||||
|
HassioError,
|
||||||
|
HomeAssistantError,
|
||||||
|
SupervisorUpdateError,
|
||||||
|
)
|
||||||
|
|
||||||
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
_LOGGER: logging.Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -144,8 +149,11 @@ class Core(CoreSysAttributes):
|
|||||||
_LOGGER.error("Systemd DBUS is not connected")
|
_LOGGER.error("Systemd DBUS is not connected")
|
||||||
|
|
||||||
# Check if image names from denylist exist
|
# Check if image names from denylist exist
|
||||||
if await self.sys_run_in_executor(self.sys_docker.check_denylist_images):
|
try:
|
||||||
self.coresys.supported = False
|
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
|
self.healthy = False
|
||||||
|
|
||||||
async def start(self):
|
async def start(self):
|
||||||
|
@ -237,14 +237,19 @@ class DockerAPI:
|
|||||||
def check_denylist_images(self) -> bool:
|
def check_denylist_images(self) -> bool:
|
||||||
"""Return a boolean if the host has images in the denylist."""
|
"""Return a boolean if the host has images in the denylist."""
|
||||||
denied_images = set()
|
denied_images = set()
|
||||||
for image in self.images.list():
|
|
||||||
for tag in image.tags:
|
try:
|
||||||
image_name = tag.split(":")[0]
|
for image in self.images.list():
|
||||||
if (
|
for tag in image.tags:
|
||||||
image_name in DOCKER_IMAGE_DENYLIST
|
image_name = tag.split(":")[0]
|
||||||
and image_name not in denied_images
|
if (
|
||||||
):
|
image_name in DOCKER_IMAGE_DENYLIST
|
||||||
denied_images.add(image_name)
|
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:
|
if not denied_images:
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user