Fix bugs with docker api 3.0.1 and fix the version (#353)

* Fix version

* fix snapshot
This commit is contained in:
Pascal Vizeli 2018-02-11 01:42:53 +01:00 committed by GitHub
parent 3bf446cbdb
commit 2f3701693d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 11 deletions

View File

@ -269,9 +269,13 @@ class DockerAddon(DockerInterface):
_LOGGER.info("Start build %s:%s", self.image, tag) _LOGGER.info("Start build %s:%s", self.image, tag)
try: try:
image = self._docker.images.build(**build_env.get_docker_args(tag)) image, log = self._docker.images.build(
**build_env.get_docker_args(tag))
_LOGGER.debug("Build %s:%s done: %s", self.image, tag, log)
image.tag(self.image, tag='latest') image.tag(self.image, tag='latest')
# Update meta data
self._meta = image.attrs self._meta = image.attrs
except (docker.errors.DockerException) as err: except (docker.errors.DockerException) as err:
@ -297,15 +301,16 @@ class DockerAddon(DockerInterface):
_LOGGER.error("Can't fetch image %s: %s", self.image, err) _LOGGER.error("Can't fetch image %s: %s", self.image, err)
return False return False
_LOGGER.info("Export image %s to %s", self.image, tar_file)
try: try:
with tar_file.open("wb") as write_tar: with tar_file.open("wb") as write_tar:
for chunk in image.stream(): for chunk in image:
write_tar.write(chunk) write_tar.write(chunk)
except (OSError, requests.exceptions.ReadTimeout) as err: except (OSError, requests.exceptions.ReadTimeout) as err:
_LOGGER.error("Can't write tar file %s: %s", tar_file, err) _LOGGER.error("Can't write tar file %s: %s", tar_file, err)
return False return False
_LOGGER.info("Export image %s to %s", self.image, tar_file) _LOGGER.info("Export image %s done", self.image)
return True return True
@docker_process @docker_process

View File

@ -40,13 +40,13 @@ setup(
], ],
include_package_data=True, include_package_data=True,
install_requires=[ install_requires=[
'async_timeout', 'async_timeout==2.0.0',
'aiohttp', 'aiohttp==2.3.10',
'docker', 'docker==3.0.1',
'colorlog', 'colorlog==3.1.2',
'voluptuous', 'voluptuous==0.10.5',
'gitpython', 'gitpython==2.1.8',
'pytz', 'pytz==2018.3',
'pyudev' 'pyudev==0.21.0'
] ]
) )