Commit 9378496a authored by Hilal Ozdemir's avatar Hilal Ozdemir Committed by Hilal Ozdemir

fixes to pass tests

parent 81365034
......@@ -343,16 +343,17 @@ class ImageList(RPCEndpoint):
config_future.add_done_callback(when_done)
try:
await first_layer_start_task
except Services.docker_util.ManifestError as err:
if show_progress:
rpc_endpoint.write('{"progress":[{"error":"%s"}]}'%str(err))
rpc_endpoint.finish()
else:
rpc_endpoint.write('{"resp_info":[{"error":"%s"}]}'%str(err))
rpc_endpoint.finish()
except Exception as err: # pylint: disable=broad-except
if rpc_endpoint:
if show_progress:
rpc_endpoint.write('{"progress":[{"error":"%s"}]}'%str(err))
rpc_endpoint.finish()
else:
rpc_endpoint.write('{"resp_info":[{"error":"%s"}]}'%str(err))
rpc_endpoint.finish()
return
if rpc_endpoint is not None:
if rpc_endpoint:
if not wait:
rpc_endpoint.write('{"resp_info":[{"started":true}]}')
rpc_endpoint.finish()
......@@ -431,7 +432,7 @@ class ImageList(RPCEndpoint):
# image.repo_digests.add(repo_digest)
# image.save()
if wait:
if rpc_endpoint and wait:
rpc_endpoint.write('{"finished":true}]}') # type: ignore
rpc_endpoint.finish() # type: ignore
......
......@@ -101,9 +101,9 @@ async def _pull_with_progress_distributed(ctx, imagename, node, force):
lastbar = None
async for data in json_streamer(resp.content, '$.progress[::]'):
err = data.get('error')
if err:
click.echo('An error occured while pulling the image. {}'.format(err))
resp_err = data.get('error')
if resp_err:
click.echo('An error occured while pulling the image. {}'.format(resp_err))
return
if data.get('finished'):
if lastbar:
......@@ -150,9 +150,9 @@ async def _pull_without_progress(ctx, imagename, node, wait, force, whole_image_
return
async for data in json_streamer(resp.content, '$.resp_info[::]'):
err = data.get('error')
if err:
click.echo('An error occured while pulling the image. {}'.format(err))
resp_err = data.get('error')
if resp_err:
click.echo('An error occured while pulling the image. {}'.format(resp_err))
return
if data.get('started'):
click.echo("Image pulling process started.")
......
......@@ -658,8 +658,8 @@ class DockerUtil: # pylint: disable=too-many-instance-attributes
"Failed to download layer from %s. Response does not have a body."%url)
if not resp.headers.get('content-length'):
raise DockerUtil.LayerDownloadFailed(
"Failed to download layer from %s. " +
"Response headers do not have content-length."%url)
"Failed to download layer from %s. "%url +
"Response headers do not have content-length.")
layer_size = int(resp.headers.get('content-length'))
......
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