This commit is contained in:
Pascal Vizeli 2017-07-11 22:38:07 +02:00
parent 40e8f411ff
commit ebf4daf4cc
5 changed files with 13 additions and 7 deletions

View File

@ -15,7 +15,7 @@ from .validate import (
from ..const import ( from ..const import (
FILE_HASSIO_ADDONS, ATTR_VERSION, ATTR_SLUG, ATTR_REPOSITORY, ATTR_LOCATON, FILE_HASSIO_ADDONS, ATTR_VERSION, ATTR_SLUG, ATTR_REPOSITORY, ATTR_LOCATON,
REPOSITORY_CORE, REPOSITORY_LOCAL, ATTR_USER, ATTR_SYSTEM) REPOSITORY_CORE, REPOSITORY_LOCAL, ATTR_USER, ATTR_SYSTEM)
from ..tools import JsonConfig from ..tools import JsonConfig, read_json_file
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -11,7 +11,6 @@ from ..const import (
ATTR_URL, ATTR_DESCRIPTON, ATTR_DETACHED, ATTR_NAME, ATTR_REPOSITORY, ATTR_URL, ATTR_DESCRIPTON, ATTR_DETACHED, ATTR_NAME, ATTR_REPOSITORY,
ATTR_BUILD, ATTR_AUTO_UPDATE, ATTR_NETWORK, ATTR_HOST_NETWORK, ATTR_BUILD, ATTR_AUTO_UPDATE, ATTR_NETWORK, ATTR_HOST_NETWORK,
BOOT_AUTO, BOOT_MANUAL) BOOT_AUTO, BOOT_MANUAL)
from ..tools import read_json_file
from ..validate import DOCKER_PORTS from ..validate import DOCKER_PORTS
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -101,13 +101,13 @@ class HomeAssistant(JsonConfig):
while True: while True:
# read homeassistant tag and install it # read homeassistant tag and install it
if not self.last_version: if not self.last_version:
await self.config.fetch_update_infos(websession) await self.config.fetch_update_infos(self.websession)
tag = self.last_version tag = self.last_version
if tag and await self.docker.install(tag): if tag and await self.docker.install(tag):
break break
_LOGGER.warning("Error on install HomeAssistant. Retry in 60sec") _LOGGER.warning("Error on install HomeAssistant. Retry in 60sec")
await asyncio.sleep(60, loop=loop) await asyncio.sleep(60, loop=self.loop)
# store version # store version
_LOGGER.info("HomeAssistant docker now installed") _LOGGER.info("HomeAssistant docker now installed")
@ -147,3 +147,10 @@ class HomeAssistant(JsonConfig):
Return a coroutine. Return a coroutine.
""" """
return self.docker.logs() return self.docker.logs()
def is_running(self):
"""Return True if docker container is running.
Return a coroutine.
"""
return self.docker.is_running()

View File

@ -128,7 +128,7 @@ class Snapshot(object):
self.homeassistant_devices = homeassistant.devices self.homeassistant_devices = homeassistant.devices
# custom image # custom image
if self.homeassistant.is_custom_image: if homeassistant.is_custom_image:
self.homeassistant_image = homeassistant.image self.homeassistant_image = homeassistant.image
def restore_homeassistant(self, homeassistant): def restore_homeassistant(self, homeassistant):

View File

@ -37,6 +37,6 @@ DOCKER_PORTS = vol.Schema({
SCHEMA_HASS_CONFIG = vol.Schema({ SCHEMA_HASS_CONFIG = vol.Schema({
vol.Optional(ATTR_DEVICES, default=[]): HASS_DEVICES, vol.Optional(ATTR_DEVICES, default=[]): HASS_DEVICES,
vol.inclusive(ATTR_IMAGE, 'custom_hass'): vol.Coerce(str), vol.Inclusive(ATTR_IMAGE, 'custom_hass'): vol.Coerce(str),
vol.inclusive(ATTR_LAST_VERSION, 'custom_hass'): vol.Coerce(str), vol.Inclusive(ATTR_LAST_VERSION, 'custom_hass'): vol.Coerce(str),
}) })