1
0
mirror of https://github.com/home-assistant/supervisor.git synced 2025-12-24 20:35:55 +00:00

Convert homeassistant into a dict (snapshot) (#90)

* Convert homeassistant into a dict

* fix lint

* fix bugs

* cleanup code

* fix cleanup
This commit is contained in:
Pascal Vizeli
2017-07-06 01:29:09 +02:00
committed by GitHub
parent e2a29b7290
commit 0ac96c207e
8 changed files with 85 additions and 49 deletions

View File

@@ -434,15 +434,14 @@ class Addon(object):
self._restore_data(data[ATTR_USER], data[ATTR_SYSTEM])
# check version / restore image
if data[ATTR_VERSION] != self.addon_docker.version:
version = data[ATTR_VERSION]
if version != self.addon_docker.version:
image_file = Path(temp, "image.tar")
if image_file.is_file():
if not await self.addon_docker.import_image(image_file):
return False
await self.addon_docker.import_image(image_file, version)
else:
if not await self.addon_docker.install(data[ATTR_VERSION]):
return False
await self.addon_docker.cleanup()
if await self.addon_docker.install(version):
await self.addon_docker.cleanup()
else:
await self.addon_docker.stop()