mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-06-24 10:56:30 +00:00

* Improve gdbus error handling * Fix logging type * Detect no dbus * Fix issue with complex * Update hassio/dbus/__init__.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/hostname.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/rauc.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Update hassio/dbus/systemd.py Co-Authored-By: Franck Nijhof <frenck@frenck.nl> * Fix black
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
"""HassOS Cli docker object."""
|
|
import logging
|
|
|
|
import docker
|
|
|
|
from ..coresys import CoreSysAttributes
|
|
from .interface import DockerInterface
|
|
|
|
_LOGGER: logging.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, tag: str):
|
|
"""Attach to running Docker container.
|
|
Need run inside executor.
|
|
"""
|
|
try:
|
|
image = self.sys_docker.images.get(f"{self.image}:{tag}")
|
|
|
|
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
|
|
)
|