Crashing on non-ascii resource property keys

Bug #1626403 reported by Roman Bogorodskiy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-keystoneclient
Fix Released
Undecided
Roman Bogorodskiy

Bug Description

keystoneclient gets broken when setting resource properties with non-ascii keys. Here's a quick way to reproduce.

1. openstack project set --property тест=бебебе my_project # works fine
2. openstack project list # fails with:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)

# locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
#

Full traceback attached.

Revision history for this message
Roman Bogorodskiy (novel) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-keystoneclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/374552

Changed in python-keystoneclient:
assignee: nobody → Roman Bogorodskiy (novel)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-keystoneclient (master)

Reviewed: https://review.openstack.org/374552
Committed: https://git.openstack.org/cgit/openstack/python-keystoneclient/commit/?id=dc9e4491779c0347f4eb770de03827b967541bf3
Submitter: Jenkins
Branch: master

commit dc9e4491779c0347f4eb770de03827b967541bf3
Author: Roman Bogorodskiy <email address hidden>
Date: Thu Sep 22 02:06:53 2016 -0400

    Fix non-ascii attributes

    It's possible to set and get custom attributes through the API, and
    it's also possible to use any Unicode strings, not only ASCII range.
    It works perfectly fine when accessing the API directly using
    e.g. curl.

    However, keystoneclient stumbles on the non-ascii keys because
    it tries to set this as an attribute for the resource class and fails
    because Python 2.7 does not support non-ascii identifiers:

    https://docs.python.org/2.7/reference/lexical_analysis.html#identifiers

    So change the logic to skip setting non-ascii attributes; they are still
    available in the dict representation.

    Closes-Bug: #1626403
    Change-Id: I267188cdb1d303e3d0fb6bd3229b606f4fe9b2d8

Changed in python-keystoneclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-keystoneclient 3.6.0

This issue was fixed in the openstack/python-keystoneclient 3.6.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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