Fix Version detection with exists container (#1193)

This commit is contained in:
Pascal Vizeli 2019-08-08 23:20:26 +02:00 committed by GitHub
parent b26dd0af19
commit bc099f0d81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,20 +76,18 @@ class HomeAssistant(JsonConfig, CoreSysAttributes):
async def load(self) -> None:
"""Prepare Home Assistant object."""
with suppress(DockerAPIError):
try:
# Evaluate Version if we lost this information
if not self.version:
if await self.instance.is_running():
self.version = self.instance.version
else:
self.version = await self.instance.get_latest_version()
self.save_data()
self.version = await self.instance.get_latest_version()
await self.instance.attach(tag=self.version)
return
_LOGGER.info("No Home Assistant Docker image %s found.", self.image)
await self.install_landingpage()
except DockerAPIError:
_LOGGER.info("No Home Assistant Docker image %s found.", self.image)
await self.install_landingpage()
else:
self.version = self.instance.version
self.save_data()
@property
def machine(self) -> str: