client does not handle unicode in image name, metadata
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance Client |
Fix Released
|
Low
|
Flavio Percoco |
Bug Description
The python-glanceclient chokes on unicode for image names, metadata keys, and metadata values. (The API is OK, this is a client problem. Examples are given below.)
Problem is twofold: using string() and using unicode() with no 'encoding' parameter (the default is to use the ascii encoding, which is why we get the 'out of range' exception).
Fix is to make sure the unicode() function is being used throughout the code with utf-8 specified as the encoding; replace uses of the string() function with the unicode() function.
Examples:
# unicode in name
$ MERC=$(echo -e "\u263f")
$ echo $MERC
☿
$ glance image-create --name Freddy-$MERC
'ascii' codec can't decode byte 0xe2 in position 30: ordinal not in range(128)
$ BB=$(echo -e "\u2047")
$ CC=$(echo -e "\u2048")
$ echo $BB
⁇
$ echo $CC
⁈
# unicode in metadata value
$ glance image-update --property ascii_key=
'ascii' codec can't decode byte 0xe2 in position 45: ordinal not in range(128)
# unicode in metadata key
$ glance image-update --property unicode_
'ascii' codec can't decode byte 0xe2 in position 38: ordinal not in range(128)
NOTE: The glance API can handle unicode fine:
$ VAL=$(echo -e "\u2645")
$ KEY=$(echo -e "\u262e")
$ echo $VAL
♅
$ echo $KEY
☮
curl -X PUT \
-H "User-Agent: curl-by-hand" \
-H "X-Auth-Token: $AUTH_TOKEN" \
-H "x-image-meta-name: unicode-$VAL" \
-H "x-image-
-H "x-image-
http://
{
"image": {
"checksum": "9490463a2a6db0
"deleted": false,
"id": "7a40d9d3-
"min_disk": 0,
"min_ram": 0,
"name": "unicode-\u2645",
"owner": "637807f80e4344
},
"size": 25165824,
"status": "active",
}
}
description: | updated |
Changed in python-glanceclient: | |
assignee: | nobody → Brian Rosmaita (brian-rosmaita) |
Changed in python-glanceclient: | |
importance: | Undecided → Low |
Changed in python-glanceclient: | |
status: | New → Triaged |
Changed in python-glanceclient: | |
assignee: | Brian Rosmaita (brian-rosmaita) → nobody |
Changed in python-glanceclient: | |
assignee: | nobody → Anita Kuno (akuno) |
Changed in python-glanceclient: | |
milestone: | none → v0.8.0 |
Changed in python-glanceclient: | |
status: | Fix Committed → Fix Released |
Fix proposed to branch: master /review. openstack. org/20807
Review: https:/