mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-06-25 19:36:29 +00:00

* Make homeassistant container constant * Update homeassistant.py * Update homeassistant.py * Update interface.py * Update homeassistant.py * Fix handling * add start function * Add typing * Fix lint * Add API call * Update logs * Fix some issue with watchdog * Fix lint
39 lines
1018 B
Python
39 lines
1018 B
Python
"""HassOS Cli docker object."""
|
|
import logging
|
|
|
|
import docker
|
|
|
|
from ..coresys import CoreSysAttributes
|
|
from .interface import DockerInterface
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
class DockerHassOSCli(DockerInterface, CoreSysAttributes):
|
|
"""Docker Hass.io wrapper for HassOS Cli."""
|
|
|
|
@property
|
|
def image(self):
|
|
"""Return name of HassOS CLI image."""
|
|
return f"homeassistant/{self.sys_arch.supervisor}-hassio-cli"
|
|
|
|
def _stop(self, remove_container=True):
|
|
"""Don't need stop."""
|
|
return True
|
|
|
|
def _attach(self):
|
|
"""Attach to running Docker container.
|
|
Need run inside executor.
|
|
"""
|
|
try:
|
|
image = self.sys_docker.images.get(self.image)
|
|
|
|
except docker.errors.DockerException:
|
|
_LOGGER.warning("Can't find a HassOS CLI %s", self.image)
|
|
|
|
else:
|
|
self._meta = image.attrs
|
|
_LOGGER.info(
|
|
"Found HassOS CLI %s with version %s", self.image, self.version
|
|
)
|