Change handling for taging

This commit is contained in:
Pascal Vizeli 2017-03-29 20:30:35 +02:00
parent aa49498ac0
commit 3abb11dab6
2 changed files with 6 additions and 3 deletions

View File

@ -40,10 +40,9 @@ class DockerBase(object):
"""
try:
_LOGGER.info("Pull image %s tag %s", self.image, tag)
self.dock.images.pull(self.image, tag=tag)
image = self.dock.images.pull(self.image, tag=tag)
if tag != "latest":
image = self.dock.images.get("{}:{}".format(self.image, tag))
if tag != 'latest':
image.tag(self.image, tag='latest')
except docker.errors.APIError:
_LOGGER.error("Can't pull %s:%s", self.image, tag)

View File

@ -5,6 +5,7 @@ import docker
from . import DockerBase
from ..const import HASSIO_DOCKER
from ..tools import get_version_from_env
_LOGGER = logging.getLogger(__name__)
HASS_DOCKER_NAME = 'homeassistant'
@ -51,6 +52,9 @@ class DockerHomeAssistant(DockerBase):
self.config.path_ssl_docker:
{'bind': '/ssl', 'mode': 'rw'},
})
self.version = get_version_from_env(
self.container.attrs['Config']['Env'])
except docker.errors.DockerException:
_LOGGER.error("Can't run %s", self.image)
return False