ec2 api breaks on non-ascii characters

Bug #1306479 reported by Kalle Happonen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Sean Dague

Bug Description

When you query the ec2 api, and it returns non-ascii data from the database, It throws something like this

2014-04-11 10:05:19.874 ERROR nova.api.ec2 [req-bc73aa28-0faa-437c-8fb1-e61188658c03 user project] Unexpected error raised: 'ascii' codec can't encode character u'\xe4' in position 1: ordinal not in range(128)

Tha cause seems to be the str() calls when calling xml.createTextNode in the /api/ec2/apirequest.py file.

This should porbably be made safe for non-ascii characters.

Tags: ec2
Tracy Jones (tjones-i)
tags: added: ec2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Sean Dague (sdague)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/120782

Sean Dague (sdague)
Changed in nova:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/120781
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=0da4d72ae6aae012f2c65c928bbab013043d09a1
Submitter: Jenkins
Branch: master

commit 0da4d72ae6aae012f2c65c928bbab013043d09a1
Author: Sean Dague <email address hidden>
Date: Thu Sep 11 08:52:43 2014 -0400

    ensure that we safely encode ec2 utf8 responses

    The ec2 response layer assumed that all strings coming back for
    results were always ascii, and exploded horribly if they weren't due
    to the use of a str() function late in the game. This updates the code
    to use safe_encode correctly when the object gets rendered.

    This also adds unit tests for the rendering functionality in
    ec2/apirequest so that we can actually feel confident that it does the
    right things with unicode.

    Change-Id: I348a728e3559fdbf0d1bc66616cc278c3370cd29
    Closes-Bug: #1306479

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to nova (master)

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

commit b6ca1871028846f8918428b1fbce75ba1c74bb75
Author: Sean Dague <email address hidden>
Date: Thu Sep 11 09:01:32 2014 -0400

    consolidate apirequest tests to single file

    There was one stray apirequest test for a formatting check in
    test_api. Bring it into the test_apirequest to for logical cohesion in
    the code. This should also make it simpler for people to expand on
    this validation later in one place if they want to.

    Change-Id: Ib9a09034b1b677b462eb0384396cd9bc64f73045
    Related-Bug: #1306479

Thierry Carrez (ttx)
Changed in nova:
milestone: none → juno-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: juno-rc1 → 2014.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.