Kaydet (Commit) 601c5a41 authored tarafından Joffrey F's avatar Joffrey F

Merge branch 'image-load' of https://github.com/hongbin/docker-py into hongbin-image-load

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
......@@ -241,13 +241,24 @@ class ImageCollection(Collection):
data (binary): Image data to be loaded.
Returns:
(generator): Progress output as JSON objects
(list of :py:class:`Image`): The images.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
return self.client.api.load_image(data)
resp = self.client.api.load_image(data)
images = []
for chunk in resp:
if 'stream' in chunk:
match = re.search(
r'(^Loaded image ID: |^Loaded image: )(.+)$',
chunk['stream']
)
if match:
image_id = match.group(2)
images.append(image_id)
return [self.get(i) for i in images]
def pull(self, name, tag=None, **kwargs):
"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment