summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Kekane <abhishek.kekane@nttdata.com>2017-08-16 15:49:47 +0530
committerAbhishek Kekane <abhishek.kekane@nttdata.com>2017-08-17 11:37:20 +0530
commit0e50837a374958d2863deef890879c960a05d8aa (patch)
treed11435a768c4de75e36097e9e6a8f848e55a2cc3
parent6fe3018de8564a20865d9350bc942e8e14296d85 (diff)
downloadpython-glanceclient-0e50837a374958d2863deef890879c960a05d8aa.tar.gz
stage call fails with TypeError
image-stage call fails with TypeError saying 'stage() takes exactly 3 arguments (4 given). The reason is stage() also accepts image_size as a argument which is not provided. Further it raises 'NoneType' object has no attribute 'headers'. The reason is stage() internally calls upload method which returns a object of RequestIdWrapper on body (which is None) and response. In stage call it again tries to add request id which requires response object but instead it has a RequestIdWrapper which fails to retrieve headers. Change-Id: I4de4be7a55f35c3533b53acd48042c7c95b4bdc0 Closes-bug: #1711090
-rw-r--r--glanceclient/v2/images.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py
index d95ebca..6d456eb 100644
--- a/glanceclient/v2/images.py
+++ b/glanceclient/v2/images.py
@@ -240,16 +240,18 @@ class Controller(object):
return body, resp
@utils.add_req_id_to_object()
- def stage(self, image_id, image_data):
+ def stage(self, image_id, image_data, image_size=None):
"""Upload the data to image staging.
:param image_id: ID of the image to upload data for.
:param image_data: File-like object supplying the data to upload.
+ :param image_size: Unused - present for backwards compatibility
"""
url = '/v2/images/%s/stage' % image_id
- return self.upload(image_id,
- image_data,
- u_url=url)
+ resp, body = self.upload(image_id,
+ image_data,
+ u_url=url)
+ return body, resp
@utils.add_req_id_to_object()
def image_import(self, image_id, method='glance-direct'):