filter doesn't handle unicode charaters

Bug #1472999 reported by Matthias Runge
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance Client
Invalid
Medium
Unassigned
OpenStack Compute (nova)
Fix Released
Medium
Richard Jones
OpenStack Dashboard (Horizon)
Invalid
High
Unassigned
python-novaclient
Fix Released
Medium
Richard Jones

Bug Description

1 go to project/instances
2. insert 'ölk' into filter field
3. enter filter
4.
UnicodeEncodeError at /project/instances/

'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128)

Request Method: GET
Request URL: http://localhost:8000/project/instances/
Django Version: 1.8.2
Exception Type: UnicodeEncodeError
Exception Value:

'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128)

Exception Location: /usr/lib64/python2.7/urllib.py in urlencode, line 1347
Python Executable: /usr/bin/python
Python Version: 2.7.10
Python Path:

['/home/mrunge/work/horizon',
 '/usr/lib64/python27.zip',
 '/usr/lib64/python2.7',
 '/usr/lib64/python2.7/plat-linux2',
 '/usr/lib64/python2.7/lib-tk',
 '/usr/lib64/python2.7/lib-old',
 '/usr/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7/site-packages',
 '/usr/lib64/python2.7/site-packages/gtk-2.0',
 '/usr/lib/python2.7/site-packages',
 '/home/mrunge/work/horizon/openstack_dashboard']

Matthias Runge (mrunge)
Changed in horizon:
importance: Undecided → High
Changed in horizon:
assignee: nobody → Ritesh (rsritesh)
status: New → Confirmed
Revision history for this message
hogetaro (hogetaro) wrote :
Download full text (7.0 KiB)

there seems to be two problems

1) horizon does not encode unicode string before setting it into url param
 novaclient/v2/servers.py: 593
            query_string = "?%s" % parse.urlencode(new_qparams)

it should encode unicode string to utf-8 before urlencode

2) but even encoding it to utf-8 , nova api cant handle it (500 error happen at api call)

2015-07-10 11:20:33.035 ERROR nova.api.openstack [req-2e7f9436-fa14-4b84-95cb-4f21e423d9aa admin admin] Caught error: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
2015-07-10 11:20:33.035 TRACE nova.api.openstack Traceback (most recent call last):
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/__init__.py", line 126, in __call__
2015-07-10 11:20:33.035 TRACE nova.api.openstack return req.get_response(self.application)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1317, in send
2015-07-10 11:20:33.035 TRACE nova.api.openstack application, catch_exc_info=False)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1281, in call_application
2015-07-10 11:20:33.035 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2015-07-10 11:20:33.035 TRACE nova.api.openstack return resp(environ, start_response)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2015-07-10 11:20:33.035 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2015-07-10 11:20:33.035 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__init__.py", line 434, in __call__
2015-07-10 11:20:33.035 TRACE nova.api.openstack response = req.get_response(self._app)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1317, in send
2015-07-10 11:20:33.035 TRACE nova.api.openstack application, catch_exc_info=False)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1281, in call_application
2015-07-10 11:20:33.035 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2015-07-10 11:20:33.035 TRACE nova.api.openstack return resp(environ, start_response)
2015-07-10 11:20:33.035 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2015-07-10 11:20:33.035 TRACE nova.api.openstack return resp(environ, start_response)
2015-07-...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
assignee: Ritesh (rsritesh) → Masco Kaliyamoorthy (masco)
status: Confirmed → In Progress
tags: added: api db string-encoding
Changed in nova:
assignee: nobody → George Peristerakis (george-peristerakis)
affects: nova → python-novaclient
Changed in python-novaclient:
assignee: George Peristerakis (george-peristerakis) → nobody
status: New → In Progress
assignee: nobody → George Peristerakis (george-peristerakis)
David Lyle (david-lyle)
Changed in horizon:
milestone: none → liberty-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

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

Changed in python-novaclient:
assignee: George Peristerakis (george-peristerakis) → Richard Jones (r1chardj0n3s)
Revision history for this message
Richard Jones (r1chardj0n3s) wrote :
Changed in nova:
assignee: nobody → Richard Jones (r1chardj0n3s)
Changed in nova:
status: New → In Progress
Revision history for this message
Richard Jones (r1chardj0n3s) wrote :

Seems like the auto-linking doesn't want to play along.

glanceclient patch is https://review.openstack.org/#/c/224991/

Changed in python-glanceclient:
assignee: nobody → Richard Jones (r1chardj0n3s)
status: New → In Progress
Revision history for this message
Rob Cresswell (robcresswell-deactivatedaccount) wrote :

I propose removing this from Horizon RC1, as it is a client based issue. However, I'm unsure if we want to temporarily patch for release, and leave a TODO for when the client bugs merge.

Matthias Runge (mrunge)
Changed in horizon:
milestone: liberty-rc1 → next
Revision history for this message
Matthias Runge (mrunge) wrote :

I removed this from rc1, but would argue, horizon shouldn't throw an exception, no matter if it's a *-client bug or not.

Revision history for this message
Richard Jones (r1chardj0n3s) wrote :

Matthias, it's not Horizon throwing the exception, it's the client code that has a bug. I don't think it's reasonable for us to try/except around every client code call just so we don't traceback when there's a bug in that code.

melanie witt (melwitt)
Changed in python-novaclient:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/224422
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=485201453a5d7a9b6b6b81d737edfce7fefb97a2
Submitter: Jenkins
Branch: master

commit 485201453a5d7a9b6b6b81d737edfce7fefb97a2
Author: Richard Jones <email address hidden>
Date: Thu Sep 17 15:05:35 2015 +1000

    Encode unicode filter arguments for server list

    Previously unicode arguments were not encoded so unicode
    exceptions were thrown when the arguments were URL encoded.

    Change-Id: I69a5ac8dcf584ad5b5604caf3c4cb16bb59d3fe3
    Partial-Bug: 1472999

Tony Breeds (o-tony)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/224431
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1c003473353a511142b30ade1aa92f6fb1633e45
Submitter: Jenkins
Branch: master

commit 1c003473353a511142b30ade1aa92f6fb1633e45
Author: Richard Jones <email address hidden>
Date: Thu Sep 17 15:09:33 2015 +1000

    Allow filtering using unicode characters

    Current code forces the filter arguments to be converted
    to a byte string using str() which prevents filtering
    using unicode characters. This patch fixes that.

    Change-Id: I3abef5da4c2614806011440a4443e869920b4afd
    Partial-Bug: 1472999

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on horizon (master)

Change abandoned by Rob Cresswell (<email address hidden>) on branch: master
Review: https://review.openstack.org/211850
Reason: Abandoned as per discussion in comments.

Changed in horizon:
status: In Progress → Invalid
Changed in nova:
status: In Progress → Fix Committed
Changed in python-novaclient:
status: In Progress → Fix Committed
Changed in python-glanceclient:
importance: Undecided → Medium
Changed in python-glanceclient:
milestone: none → 1.1.1
Changed in python-novaclient:
milestone: none → 2.32.0
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-novaclient (master)

Change abandoned by melanie witt (<email address hidden>) on branch: master
Review: https://review.openstack.org/200649
Reason: I think this was fixed by https://review.openstack.org/#/c/224422

Please restore if that's not the case.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/249101

Masco (masco)
Changed in horizon:
assignee: Masco (masco) → nobody
Changed in nova:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-glanceclient (master)

Change abandoned by Glance Bot (<email address hidden>) on branch: master
Review: https://review.openstack.org/224991

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/kilo)

Change abandoned by Dave Walker (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/249101
Reason:
stable/kilo closed for 2015.1.4

This release is now pending its final release and no freeze exception has
been seen for this changeset. Therefore, I am now abandoning this change.

If this is not correct, please urgently raise a thread on openstack-dev.

More details at: https://wiki.openstack.org/wiki/StableBranch

Revision history for this message
Ian Cordasco (icordasc) wrote :

The change on glanceclient was abandoned due to inactivity. I've updated the status to reflect that.

Changed in python-glanceclient:
status: In Progress → Triaged
assignee: Richard Jones (r1chardj0n3s) → nobody
milestone: 1.1.1 → none
Akihiro Motoki (amotoki)
Changed in horizon:
milestone: next → none
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-glanceclient (master)

Change abandoned by Sean McGinnis (<email address hidden>) on branch: master
Review: https://review.opendev.org/224991
Reason: I don't think this is still an issue. Feel free to restore and update if it is and if you would like to continue with this.

Revision history for this message
Cyril Roelandt (cyril-roelandt) wrote :

$ glance image-list --tag ölk

^ this command does not crash with a recent version of glanceclient running on Python3, so I'll have to agree with Sean and consider this bug invalid now. Feel free to reopen if needed.

Changed in python-glanceclient:
status: Triaged → Invalid
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.