Activity log for bug #1061150

Date Who What changed Old value New value Message
2012-10-03 18:29:06 Brian Rosmaita bug added bug
2012-10-22 15:55:33 Brian Rosmaita description The python-glanceclient chokes on unicode for image names, metadata keys, and metadata values. 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=unicode-${BB} 7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c 'ascii' codec can't decode byte 0xe2 in position 45: ordinal not in range(128) # unicode in metadata key $ glance image-update --property unicode_key_${CC}=ascii-value 7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c '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-meta-property-$KEY: the-key-is-unicode" \ -H "x-image-meta-property-unicode_value: my-$VAL" \ http://50.57.98.195:9292/v1/images/7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c { "image": { "checksum": "9490463a2a6db02c08fbe9016e168ca4", "container_format": "ami", "created_at": "2012-10-01T18:23:14", "deleted": false, "deleted_at": null, "disk_format": "ami", "id": "7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c", "is_public": false, "min_disk": 0, "min_ram": 0, "name": "unicode-\u2645", "owner": "637807f80e43444c9676abc18100838c", "properties": { "unicode_value": "my-\u2645", "\u262e": "the-key-is-unicode" }, "protected": false, "size": 25165824, "status": "active", "updated_at": "2012-10-03T18:22:27" } } 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=unicode-${BB} 7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c 'ascii' codec can't decode byte 0xe2 in position 45: ordinal not in range(128) # unicode in metadata key $ glance image-update --property unicode_key_${CC}=ascii-value 7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c '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-meta-property-$KEY: the-key-is-unicode" \   -H "x-image-meta-property-unicode_value: my-$VAL" \  http://50.57.98.195:9292/v1/images/7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c {     "image": {         "checksum": "9490463a2a6db02c08fbe9016e168ca4",         "container_format": "ami",         "created_at": "2012-10-01T18:23:14",         "deleted": false,         "deleted_at": null,         "disk_format": "ami",         "id": "7a40d9d3-ee1d-48a1-8e2a-6c8ae01b7b4c",         "is_public": false,         "min_disk": 0,         "min_ram": 0,         "name": "unicode-\u2645",         "owner": "637807f80e43444c9676abc18100838c",         "properties": {             "unicode_value": "my-\u2645",             "\u262e": "the-key-is-unicode"         },         "protected": false,         "size": 25165824,         "status": "active",         "updated_at": "2012-10-03T18:22:27"     } }
2012-10-22 16:19:22 Brian Rosmaita python-glanceclient: assignee Brian Rosmaita (brian-rosmaita)
2012-12-27 17:28:39 Iccha Sethi python-glanceclient: importance Undecided Low
2013-01-17 14:26:52 Iccha Sethi python-glanceclient: status New Triaged
2013-01-17 14:27:11 Brian Rosmaita python-glanceclient: assignee Brian Rosmaita (brian-rosmaita)
2013-01-29 19:16:55 Anita Kuno python-glanceclient: assignee Anita Kuno (akuno)
2013-01-30 14:19:29 OpenStack Infra python-glanceclient: status Triaged In Progress
2013-01-30 14:19:29 OpenStack Infra python-glanceclient: assignee Anita Kuno (akuno) Flavio Percoco Premoli (flaper87)
2013-02-18 18:58:17 OpenStack Infra python-glanceclient: status In Progress Fix Committed
2013-02-21 20:56:46 Brian Waldon python-glanceclient: milestone v0.8.0
2013-02-21 22:25:10 Brian Waldon python-glanceclient: status Fix Committed Fix Released