jumpgate
jumpgate copied to clipboard
image upload fails with a key error
If you attempt to upload an image with the glance client, gunicorn (with logging at the debug level will report) Unexpected Error Traceback (most recent call last): File "api.py", line 96, in falcon.api.API.call (falcon/api.c:1635) File "api_helpers.py", line 262, in falcon.api_helpers._wrap_with_before.do_before (falcon/api_helpers.c:3405) File "api_helpers.py", line 262, in falcon.api_helpers._wrap_with_before.do_before (falcon/api_helpers.c:3405) File "api_helpers.py", line 262, in falcon.api_helpers._wrap_with_before.do_before (falcon/api_helpers.c:3405) File "api_helpers.py", line 262, in falcon.api_helpers._wrap_with_before.do_before (falcon/api_helpers.c:3405) File "api_helpers.py", line 281, in falcon.api_helpers._wrap_with_after.do_after (falcon/api_helpers.c:3752) File "api_helpers.py", line 281, in falcon.api_helpers._wrap_with_after.do_after (falcon/api_helpers.c:3752) File "/home/markj/jumpgate/jumpgate/image/drivers/sl/images.py", line 603, in on_post 'name': headers['x-image-meta-name'], KeyError: 'x-image-meta-name' POST /image/v1/images 500 Internal Server Error [ReqId: req-8894342e-b941-11e3-9480-08002769f441] 192.168.61.1 - - [31/Mar/2014:22:01:26 -0400] "POST /image/v1/images HTTP/1.1" 500 101 "-" "python-glanceclient"
'name': headers['x-image-meta-name'],
KeyError: 'x-image-meta-name' POST /image/v1/images 500 Internal Server Error [ReqId: req-8894342e-b941-11e3-9480-08002769f441] 192.168.61.1 - - [31/Mar/2014:22:01:26 -0400] "POST /image/v1/images HTTP/1.1" 500 101 "-" "python-glanceclient"
The problem appears to be that line 603 of jumpgate/image/drivers/sl/images.py reads
'name': headers['x-image-meta-name'],
instead of
'name': headers.get('x-image-meta-name'),
A similar error exists on line 608 where the get method is not used (and the brackets need to be changed to parenthesis for the method).
Thanks for the report. I believe this functionality is actually not quite done being implemented. The API call that glance is using appears to be entirely mocked out until we can determine what to do with it. That is being implemented here: #66, however it is just with the v2 version of the API, not with v1.