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

commit 5fdb9226d269af069bfcbd42cff401c9d089b7dd
Author: Chris Dent <cd...@anticdent.org>
Date:   Thu Sep 22 12:58:41 2016 +0000

    [placement] ensure that allow headers are native strings
    
    mod-wsgi checks that response header values are what's described
    as "native strings". This means whatever `str` is in either
    python 2 or 3, but never `unicode`. When they are not mod-wsgi
    will 500. For the most part this is taken care of by webob, but in
    the case of the 405 handling, the webob response is not being
    fully massaged.
    
    mod-wsgi is doing this because it supposed to. Python WSGI server
    gateways have different expectations of headers depending on whether
    the Python is 2 or 3. See
    
    https://www.python.org/dev/peps/pep-3333/#a-note-on-string-types
    
    In addition to the unit test, the gabbi tests are now using a
    version of wsgi-intercept that will raise a TypeError when the
    application response headers are not using the correct form. This
    check needs to be done in wsgi-intercept rather than the gabbi tests
    because both wsgi-intercept and the http client makes requests
    transform the headers for their own purposes.
    
    This fix ensures that instead of a 500 the correct 405 response
    happens.
    
    Closes-Bug: #1626496
    Depends-On: I3b8aabda929fe39b60e645abb6fabb9769554829
    Change-Id: Ifa436e11e79adc2e159b4c5e7d3623d9a792b5f7


** Changed in: nova
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1626496

Title:
  when placement API sends a 405 the header value is in the incorrect
  format

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  When the placement handlers raise an HTTPMethodNotAllowed response,
  the headers are set with those methods that are allowed. These need to
  be not unicode (it's not clear how they get to be unicode (in 2.7) in
  the first place, but something is doing it, and that's not right)
  otherwise we get:

  ```
  2016-09-22 11:03:01.875 22919 ERROR nova.api.openstack.placement.handler 
HTTPMethodNotAllowed: The method specified is not allowed for this resource.
  2016-09-22 11:03:01.875 22919 ERROR nova.api.openstack.placement.handler 
  2016-09-22 11:03:01.877 22919 INFO nova.api.openstack.placement.requestlog 
[req-524fdd42-0f19-4eb3-827f-99ae22fc6dd9 admin admin] 10.0.2.15 "DELETE 
/placement/resource_providers" status: 405 len: 133
  mod_wsgi (pid=22919): Exception occurred processing WSGI script 
'/usr/local/bin/nova-placement-api'.
  TypeError: expected byte string object for header value, value of type 
unicode found
  ```

  wherein the service correctly tries to send a 405 but then the
  mod_wsgi server blows up on the data it is getting.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1626496/+subscriptions

-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : yahoo-eng-team@lists.launchpad.net
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to