diff options
author | Joffrey F <joffrey@docker.com> | 2018-11-28 11:24:21 -0800 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2018-11-28 11:27:04 -0800 |
commit | c53423f11851a69fa18783b5b0b801a24d8d2f82 (patch) | |
tree | c481d3ac2096d7e1f6b0e6ee2fdffe670f685d14 /docker/models/images.py | |
parent | a74d546864b64ba03dce1e3407d3b0cd5badee9f (diff) | |
download | docker-py-adw1n-i2116.tar.gz |
Update DockerClient.images.pull to always stream responseadw1n-i2116
Also raise a warning when users attempt to specify the "stream" parameter
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker/models/images.py')
-rw-r--r-- | docker/models/images.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docker/models/images.py b/docker/models/images.py index f8b842a..30e86f1 100644 --- a/docker/models/images.py +++ b/docker/models/images.py @@ -1,5 +1,6 @@ import itertools import re +import warnings import six @@ -425,8 +426,21 @@ class ImageCollection(Collection): if not tag: repository, tag = parse_repository_tag(repository) - kwargs['stream'] = False - self.client.api.pull(repository, tag=tag, **kwargs) + if 'stream' in kwargs: + warnings.warn( + '`stream` is not a valid parameter for this method' + ' and will be overridden' + ) + del kwargs['stream'] + + pull_log = self.client.api.pull( + repository, tag=tag, stream=True, **kwargs + ) + for _ in pull_log: + # We don't do anything with the logs, but we need + # to keep the connection alive and wait for the image + # to be pulled. + pass if tag: return self.get('{0}{2}{1}'.format( repository, tag, '@' if tag.startswith('sha256:') else ':' |