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

Fix handling with docker container (#7)

* Fix handling with docker container

* Fix lint

* update version

* fix lint v2

* fix signal handling

* fix log output
This commit is contained in:
Pascal Vizeli
2017-04-20 14:59:03 +02:00
committed by GitHub
parent 7a0b9cc1ac
commit d285fd4ad4
10 changed files with 82 additions and 37 deletions

View File

@@ -15,7 +15,7 @@ from .const import (
from .scheduler import Scheduler
from .dock.homeassistant import DockerHomeAssistant
from .dock.supervisor import DockerSupervisor
from .tools import get_arch_from_image
from .tools import get_arch_from_image, get_local_ip
_LOGGER = logging.getLogger(__name__)
@@ -52,6 +52,9 @@ class HassIO(object):
await self.supervisor.attach()
await self.supervisor.cleanup()
# set api endpoint
self.config.api_endpoint = await get_local_ip(self.loop)
# hostcontroll
host_info = await self.host_controll.info()
if host_info:
@@ -72,7 +75,7 @@ class HassIO(object):
# schedule update info tasks
self.scheduler.register_task(
self.config.fetch_update_infos, RUN_UPDATE_INFO_TASKS,
first_run=True)
now=True)
# first start of supervisor?
if not await self.homeassistant.exists():
@@ -85,7 +88,7 @@ class HassIO(object):
# schedule addon update task
self.scheduler.register_task(
self.addons.relaod, RUN_RELOAD_ADDONS_TASKS, first_run=True)
self.addons.relaod, RUN_RELOAD_ADDONS_TASKS, now=True)
# schedule self update task
self.scheduler.register_task(
@@ -95,6 +98,7 @@ class HassIO(object):
"""Start HassIO orchestration."""
# start api
await self.api.start()
_LOGGER.info("Start hassio api on %s", self.config.api_endpoint)
# HomeAssistant is already running / supervisor have only reboot
if await self.homeassistant.is_running():
@@ -112,6 +116,10 @@ class HassIO(object):
async def stop(self, exit_code=0):
"""Stop a running orchestration."""
# don't process scheduler anymore
self.scheduler.stop()
# process stop task pararell
tasks = [self.websession.close(), self.api.stop()]
await asyncio.wait(tasks, loop=self.loop)