diff options
author | Abhishek Kekane <abhishek.kekane@nttdata.com> | 2017-08-16 15:49:47 +0530 |
---|---|---|
committer | Brian Rosmaita <rosmaita.fossdev@gmail.com> | 2017-08-21 19:37:02 +0000 |
commit | f7ce62b08901b16c472cc4ec84831f2144a55cc6 (patch) | |
tree | 6ffca7a5a104c7a12a1f8191b75eafaf301809dc | |
parent | bd4d010531c87a4b6243155fde78455439d97eb7 (diff) | |
download | python-glanceclient-f7ce62b08901b16c472cc4ec84831f2144a55cc6.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
(cherry picked from commit 0e50837a374958d2863deef890879c960a05d8aa)
-rw-r--r-- | glanceclient/v2/images.py | 10 |
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'): |