mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-19 15:16:33 +00:00
Fix local Add-on restore on blank instance (#3403)
Make sure to not reference version attribute from the DockerAddon instance since it is not yet populated in case this instance hadn't installed that Add-on previously. Use the higher level Images.load() API which returns a list of images instead of loading with the lower level API and then search for the image we just imported.
This commit is contained in:
parent
c8b49aba42
commit
69c2517d52
@ -582,9 +582,15 @@ class DockerAddon(DockerInterface):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
with tar_file.open("rb") as read_tar:
|
with tar_file.open("rb") as read_tar:
|
||||||
self.sys_docker.api.load_image(read_tar, quiet=True)
|
docker_image_list = self.sys_docker.images.load(read_tar)
|
||||||
|
|
||||||
docker_image = self.sys_docker.images.get(f"{self.image}:{self.version}")
|
if len(docker_image_list) != 1:
|
||||||
|
_LOGGER.warning(
|
||||||
|
"Unexpected image count %d while importing image from tar",
|
||||||
|
len(docker_image_list),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
docker_image = docker_image_list[0]
|
||||||
except (docker.errors.DockerException, OSError) as err:
|
except (docker.errors.DockerException, OSError) as err:
|
||||||
_LOGGER.error("Can't import image %s: %s", self.image, err)
|
_LOGGER.error("Can't import image %s: %s", self.image, err)
|
||||||
raise DockerError() from err
|
raise DockerError() from err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user