mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-09 18:26: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,
|
||||
version: AwesomeVersion,
|
||||
expected_image: str,
|
||||
expected_arch: CpuArch | None = None,
|
||||
expected_cpu_arch: CpuArch | None = None,
|
||||
) -> None:
|
||||
"""Check we have expected image with correct arch."""
|
||||
expected_image_arch = (
|
||||
str(expected_arch) if expected_arch else self.sys_arch.supervisor
|
||||
expected_image_cpu_arch = (
|
||||
str(expected_cpu_arch) if expected_cpu_arch else self.sys_arch.supervisor
|
||||
)
|
||||
image_name = f"{expected_image}:{version!s}"
|
||||
if self.image == expected_image:
|
||||
@ -478,13 +478,22 @@ class DockerInterface(JobGroup, ABC):
|
||||
image_arch = f"{image_arch}/{image.attrs['Variant']}"
|
||||
|
||||
# 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
|
||||
_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
|
||||
with suppress(DockerError):
|
||||
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(
|
||||
name="docker_interface_update",
|
||||
|
Loading…
x
Reference in New Issue
Block a user