mirror of
				https://github.com/home-assistant/supervisor.git
				synced 2025-11-04 08:29:40 +00:00 
			
		
		
		
	* Support control of hassos-cli * Update const.py * Update validate.py * Update supervisor.py * Create hassos_cli.py * Update hassos_cli.py * Update hassos_cli.py * Update hassos.py * Update tasks.py * Update hassos.py * Update API.md * Update API.md * Update const.py * Update hassos.py * Update __init__.py * Fix lint * fix * Fix logging * change order * Fix download
		
			
				
	
	
		
			38 lines
		
	
	
		
			978 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			978 B
		
	
	
	
		
			Python
		
	
	
	
	
	
"""HassOS Cli docker object."""
 | 
						|
import logging
 | 
						|
 | 
						|
import docker
 | 
						|
 | 
						|
from .interface import DockerInterface
 | 
						|
from ..coresys import CoreSysAttributes
 | 
						|
 | 
						|
_LOGGER = logging.getLogger(__name__)
 | 
						|
 | 
						|
 | 
						|
class DockerHassOSCli(DockerInterface, CoreSysAttributes):
 | 
						|
    """Docker hassio wrapper for HassOS Cli."""
 | 
						|
 | 
						|
    @property
 | 
						|
    def image(self):
 | 
						|
        """Return name of HassOS cli image."""
 | 
						|
        return f"homeassistant/{self.sys_arch}-hassio-cli"
 | 
						|
 | 
						|
    def _stop(self):
 | 
						|
        """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)
 |