mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-10 18:56:30 +00:00
Fix container image detection for aarch64 (#5898)
This commit is contained in:
parent
2eb9ec20d6
commit
bac7c21fe8
@ -455,11 +455,11 @@ class DockerInterface(JobGroup, ABC):
|
|||||||
self,
|
self,
|
||||||
version: AwesomeVersion,
|
version: AwesomeVersion,
|
||||||
expected_image: str,
|
expected_image: str,
|
||||||
expected_arch: CpuArch | None = None,
|
expected_cpu_arch: CpuArch | None = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Check we have expected image with correct arch."""
|
"""Check we have expected image with correct arch."""
|
||||||
expected_image_arch = (
|
expected_image_cpu_arch = (
|
||||||
str(expected_arch) if expected_arch else self.sys_arch.supervisor
|
str(expected_cpu_arch) if expected_cpu_arch else self.sys_arch.supervisor
|
||||||
)
|
)
|
||||||
image_name = f"{expected_image}:{version!s}"
|
image_name = f"{expected_image}:{version!s}"
|
||||||
if self.image == expected_image:
|
if self.image == expected_image:
|
||||||
@ -478,13 +478,22 @@ class DockerInterface(JobGroup, ABC):
|
|||||||
image_arch = f"{image_arch}/{image.attrs['Variant']}"
|
image_arch = f"{image_arch}/{image.attrs['Variant']}"
|
||||||
|
|
||||||
# If we have an image and its the right arch, all set
|
# If we have an image and its the right arch, all set
|
||||||
if MAP_ARCH[expected_image_arch] == image_arch:
|
# It seems that newer Docker version return a variant for arm64 images.
|
||||||
|
# Make sure we match linux/arm64 and linux/arm64/v8.
|
||||||
|
expected_image_arch = MAP_ARCH[expected_image_cpu_arch]
|
||||||
|
if image_arch.startswith(expected_image_arch):
|
||||||
return
|
return
|
||||||
|
_LOGGER.info(
|
||||||
|
"Image %s has arch %s, expected %s. Reinstalling.",
|
||||||
|
image_name,
|
||||||
|
image_arch,
|
||||||
|
expected_image_arch,
|
||||||
|
)
|
||||||
|
|
||||||
# We're missing the image we need. Stop and clean up what we have then pull the right one
|
# We're missing the image we need. Stop and clean up what we have then pull the right one
|
||||||
with suppress(DockerError):
|
with suppress(DockerError):
|
||||||
await self.remove()
|
await self.remove()
|
||||||
await self.install(version, expected_image, arch=expected_image_arch)
|
await self.install(version, expected_image, arch=expected_image_cpu_arch)
|
||||||
|
|
||||||
@Job(
|
@Job(
|
||||||
name="docker_interface_update",
|
name="docker_interface_update",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user