mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-08 01:36:29 +00:00
Always pass explicit architecture of installed add-ons (#4786)
* Pass architecture of installed add-on on update When using multi-architecture container images, the architecture of the add-on is not passed to Docker in all cases. This causes the architecture of the Supervisor container to be used, which potentially is not supported by the add-on in question. This commit passes the architecture of the add-on to Docker, so that the correct image is pulled. * Call update with architecture * Also pass architecture on add-on restore * Fix pytest
This commit is contained in:
parent
3cc6bd19ad
commit
3e760f0d85
@ -718,7 +718,7 @@ class Addon(AddonModel):
|
||||
store = self.addon_store.clone()
|
||||
|
||||
try:
|
||||
await self.instance.update(store.version, store.image)
|
||||
await self.instance.update(store.version, store.image, arch=self.arch)
|
||||
except DockerError as err:
|
||||
raise AddonsError() from err
|
||||
|
||||
@ -1209,12 +1209,14 @@ class Addon(AddonModel):
|
||||
await self.instance.import_image(image_file)
|
||||
else:
|
||||
with suppress(DockerError):
|
||||
await self.instance.install(version, restore_image)
|
||||
await self.instance.install(
|
||||
version, restore_image, self.arch
|
||||
)
|
||||
await self.instance.cleanup()
|
||||
elif self.instance.version != version or self.legacy:
|
||||
_LOGGER.info("Restore/Update of image for addon %s", self.slug)
|
||||
with suppress(DockerError):
|
||||
await self.instance.update(version, restore_image)
|
||||
await self.instance.update(version, restore_image, self.arch)
|
||||
self._check_ingress_port()
|
||||
|
||||
# Restore data and config
|
||||
|
@ -602,7 +602,11 @@ class DockerAddon(DockerInterface):
|
||||
on_condition=DockerJobError,
|
||||
)
|
||||
async def update(
|
||||
self, version: AwesomeVersion, image: str | None = None, latest: bool = False
|
||||
self,
|
||||
version: AwesomeVersion,
|
||||
image: str | None = None,
|
||||
latest: bool = False,
|
||||
arch: CpuArch | None = None,
|
||||
) -> None:
|
||||
"""Update a docker image."""
|
||||
image = image or self.image
|
||||
@ -613,7 +617,11 @@ class DockerAddon(DockerInterface):
|
||||
|
||||
# Update docker image
|
||||
await self.install(
|
||||
version, image=image, latest=latest, need_build=self.addon.latest_need_build
|
||||
version,
|
||||
image=image,
|
||||
latest=latest,
|
||||
arch=arch,
|
||||
need_build=self.addon.latest_need_build,
|
||||
)
|
||||
|
||||
@Job(
|
||||
|
@ -68,7 +68,7 @@ async def test_image_added_removed_on_update(
|
||||
await coresys.addons.update(TEST_ADDON_SLUG)
|
||||
build.assert_not_called()
|
||||
install.assert_called_once_with(
|
||||
AwesomeVersion("10.0.0"), "test/amd64-my-ssh-addon", False, None
|
||||
AwesomeVersion("10.0.0"), "test/amd64-my-ssh-addon", False, "amd64"
|
||||
)
|
||||
|
||||
assert install_addon_ssh.need_update is False
|
||||
|
Loading…
x
Reference in New Issue
Block a user