Exception on running glance commands with non-ASCII arguments

Bug #1182824 reported by Flavio Percoco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Flavio Percoco
Grizzly
Fix Released
Medium
Flavio Percoco

Bug Description

Running commands such as glance image-show/image-download/image-update/image-delete with non-ASCII arguments produces the following exception:

[root@gold-vdsc ~(keystone_admin)]$ glance image-delete כדגכגדש
Request returned failure status.
Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/eventlet/wsgi.py", line 382, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 326, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.6/site-packages/keystone/middleware/auth_token.py", line 293, in __call__
    return self.app(env, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 326, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 326, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 326, in __call__
    response = req.get_response(self.application)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/lib/python2.6/site-packages/paste/urlmap.py", line 203, in __call__
    return app(environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.6/site-packages/Routes-1.12.3-py2.6.egg/routes/middleware.py", line 131, in __call__
    response = self.app(environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__
    return resp(environ, start_response)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 533, in __call__
    request, **action_args)
  File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 550, in dispatch
    return method(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/api/v1/images.py", line 203, in detail
    images = registry.get_images_detail(req.context, **params)
  File "/usr/lib/python2.6/site-packages/glance/registry/__init__.py", line 128, in get_images_detail
    return c.get_images_detailed(**kwargs)
  File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 113, in get_images_detailed
    res = self.do_request("GET", "/images/detail", params=params)
  File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 89, in do_request
    action, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 63, in wrapped
    return func(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 442, in do_request
    url = self._construct_url(action, params)
  File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 458, in _construct_url
    query = urllib.urlencode(params)
  File "/usr/lib64/python2.6/urllib.py", line 1281, in urlencode
    v = quote_plus(str(v))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)
 (HTTP 500)

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

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

Changed in glance:
assignee: nobody → Flavio Percoco (flaper87)
status: New → In Progress
Changed in glance:
importance: Undecided → Medium
tags: added: grizzly-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/30112
Committed: http://github.com/openstack/glance/commit/db33d99af2b16ae81f815c63a6aea851318a2b34
Submitter: Jenkins
Branch: master

commit db33d99af2b16ae81f815c63a6aea851318a2b34
Author: Flaper Fesp <email address hidden>
Date: Wed May 22 15:40:48 2013 +0200

    Encode headers and params

    BaseClient currently fails when non-ascii characters are passed in
    paramas and headers. This patch ensures those params are correctly
    encoded before the request is made.

    The patch adds strutils from oslo and updates gettextutils.

    Fixes bug: #1182824

    Change-Id: I813d745d76700c77f1871b151a76ff8b72ea92d4

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/31484

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/grizzly)

Reviewed: https://review.openstack.org/31484
Committed: http://github.com/openstack/glance/commit/580eb6f62168a11061a80f6e95e3bdb77d1d73f6
Submitter: Jenkins
Branch: stable/grizzly

commit 580eb6f62168a11061a80f6e95e3bdb77d1d73f6
Author: Flaper Fesp <email address hidden>
Date: Wed May 22 15:40:48 2013 +0200

    Encode headers and params

    BaseClient currently fails when non-ascii characters are passed in
    paramas and headers. This patch ensures those params are correctly
    encoded before the request is made.

    The patch adds strutils from oslo and updates gettextutils.

    Fixes bug: #1182824

    (cherry-picked: db33d99af2b16ae81f815c63a6aea851318a2b34)

    Conflicts:
     openstack-common.conf

    Change-Id: I12fc2d93b10c43091c1e921be2db1258beb18439

tags: added: in-stable-grizzly
Thierry Carrez (ttx)
Changed in glance:
milestone: none → havana-2
status: Fix Committed → Fix Released
Alan Pevec (apevec)
tags: removed: grizzly-backport-potential in-stable-grizzly
Thierry Carrez (ttx)
Changed in glance:
milestone: havana-2 → 2013.2
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.