Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

image upload fails with a key error #82

@markj-outworx

Description

@markj-outworx

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).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions