log when setting object properties to non-ascii values

Bug #1503898 reported by Lin Hua Cheng
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Medium
Steve Martinelli

Bug Description

Using non-ascii characters on the property is failing

Output:
(openstack) container set --property test=您好1 您好1
'ascii' codec can't decode byte 0xe6 in position 27: ordinal not in range(128)

property are passed as HTTP header to swift API.

HTTP header however doesn't support non-ascii characters:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2
http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2

Add a validation to check the property values before sending to keystone

Revision history for this message
Steve Martinelli (stevemar) wrote :

i whipped up a patch:

stevemar@ubuntu:/opt/stack/python-openstackclient$ openstack container set mycon2 --property "k=é" --property p=q
Cannot set properties to non-ascii values, skipping
stevemar@ubuntu:/opt/stack/python-openstackclient$ openstack container show mycon2
+--------------+---------------------------------------+
| Field | Value |
+--------------+---------------------------------------+
| account | AUTH_658ce392811b491cbe42abcf851a8e85 |
| bytes_used | 0 |
| container | mycon2 |
| object_count | 0 |
| properties | p='q' |
+--------------+---------------------------------------+

Revision history for this message
Steve Martinelli (stevemar) wrote :
Changed in python-openstackclient:
assignee: nobody → Steve Martinelli (stevemar)
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (master)

Reviewed: https://review.openstack.org/236741
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=cfd2bf5882b72d6dbd09a1839b63ed41f3834365
Submitter: Jenkins
Branch: master

commit cfd2bf5882b72d6dbd09a1839b63ed41f3834365
Author: Steve Martinelli <email address hidden>
Date: Sun Oct 18 16:03:08 2015 -0400

    validate non-ascii values for swift properties

    skip properties that are non-ascii values, but proceed
    with properties that work. log these failed values back
    to the user.

    Change-Id: Iaca8909f4465a01c8aebfd290b1a322823702359
    Closes-Bug: 1503898

Changed in python-openstackclient:
status: In Progress → Fix Committed
summary: - Setting swift object properties with non-ascii fails
+ log when setting object properties to non-ascii values
Changed in python-openstackclient:
milestone: none → 1.9.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.