-
Notifications
You must be signed in to change notification settings - Fork 29
image upload fails with a key error #82
Description
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).