Editing a tenant description with a special characters breaks the app

Bug #915764 reported by Adrian Moya
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Invalid
Medium
Unassigned

Bug Description

To reproduce:
Login
Edit a tenant and paste the following description:
"Descripción"
Receive an: Error: Unhandled error.

Now the tenants page gives errors (Error: Unable to get tenant info: Unhandled error). Logout and try to login again and you'll get an Error: Unhandled error and be unable to log in again.

Keystone Log:

root : ERROR 'ascii' codec can't decode byte 0xf3 in position 9: ordinal not in range(128)
Traceback (most recent call last):
  File "/opt/stack/keystone/keystone/utils.py", line 60, in check_error
    return func(*args, **kwargs)
  File "/opt/stack/keystone/keystone/controllers/tenant.py", line 26, in get_tenants
    return utils.send_result(200, req, tenants)
  File "/opt/stack/keystone/keystone/utils.py", line 121, in send_result
    content = result.to_json()
  File "/opt/stack/keystone/keystone/logic/types/tenant.py", line 137, in to_json
    values = [t.to_dict()["tenant"] for t in self.values]
  File "/opt/stack/keystone/keystone/logic/types/tenant.py", line 105, in to_dict
    "description": unicode(self.description),
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf3 in position 9: ordinal not in range(128)
eventlet.wsgi.server: DEBUG 192.168.4.100 - - [06/Jan/2012 20:33:56] "GET /v2.0/tenants?fresh=1325898236.31 HTTP/1.1" 500 299 0.055550

Adrian Moya (adrianmoya)
description: updated
description: updated
Changed in horizon:
importance: Undecided → Medium
milestone: none → essex-4
status: New → Confirmed
Revision history for this message
Mike Perez (thingee) wrote :

Looks like keystone.tenants has charset latin1:

mysql> show create table keystone.tenants;
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tenants | CREATE TABLE `tenants` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `desc` varchar(255) DEFAULT NULL,
  `enabled` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Devin Carlen (devcamcar)
Changed in horizon:
assignee: nobody → Nebula (nebula)
Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

This is 100% a deployment issue. Set your database tables to use UTF8 encoding and set the sqlalchemy connection string to use the utf8 charset.

Changed in horizon:
status: Confirmed → Invalid
Revision history for this message
Adrian Moya (adrianmoya) wrote :

Probably an issue with devstack then, as I used the script to install the whole thing.

Revision history for this message
Gabriel Hurley (gabriel-hurley) wrote :

Yep. I've already opened a bug and gerrit review for fixing it in devstack.

Devin Carlen (devcamcar)
Changed in horizon:
milestone: essex-4 → none
Curtis Hovey (sinzui)
Changed in horizon:
assignee: Registry Administrators (registry) → nobody
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.