Show a pretty progressbar when uploading and downloading an image.
Add a new module that contain generic wrapper for file and iterator, which are used to wrap image to upload and the request body iterator in upload and download cases repectively, to show and advance a pretty progress bar when this laters are consumed, The progress bar is triggered by adding a --progress command line argument to commands: image-create, image-download or image-update. Change-Id: I2ba42fd0c58f4fa087adb568ec3f08246cae3759 bug fix: LP#1112309 blueprint: progressbar-when-uploading
This commit is contained in:
@@ -84,9 +84,8 @@ class Controller(object):
|
||||
resp, body = self.http_client.raw_request('GET', url)
|
||||
checksum = resp.getheader('content-md5', None)
|
||||
if do_checksum and checksum is not None:
|
||||
return utils.integrity_iter(body, checksum)
|
||||
else:
|
||||
return body
|
||||
body.set_checksum(checksum)
|
||||
return body
|
||||
|
||||
def upload(self, image_id, image_data):
|
||||
"""
|
||||
@@ -114,7 +113,7 @@ class Controller(object):
|
||||
try:
|
||||
setattr(image, key, value)
|
||||
except warlock.InvalidOperation, e:
|
||||
raise TypeError(unicode(message))
|
||||
raise TypeError(utils.exception_to_str(e))
|
||||
|
||||
resp, body = self.http_client.json_request('POST', url, body=image)
|
||||
#NOTE(esheffield): remove 'self' for now until we have an elegant
|
||||
|
||||
Reference in New Issue
Block a user