mirror of https://github.com/docker/docker-py.git
Merge branch 'image-load' of https://github.com/hongbin/docker-py into hongbin-image-load
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
commit
601c5a41d2
|
@ -241,13 +241,24 @@ class ImageCollection(Collection):
|
||||||
data (binary): Image data to be loaded.
|
data (binary): Image data to be loaded.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(generator): Progress output as JSON objects
|
(list of :py:class:`Image`): The images.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
:py:class:`docker.errors.APIError`
|
:py:class:`docker.errors.APIError`
|
||||||
If the server returns an error.
|
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):
|
def pull(self, name, tag=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue