← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1674392] Re: placement api requires content-type on put and post even when no body

 

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

commit 6dd047a3307a1056077608fd5bc2d1c3b3285338
Author: Chris Dent <cdent@xxxxxxxxxxxxx>
Date:   Mon Mar 20 17:46:27 2017 +0000

    [placement] Allow PUT and POST without bodies
    
    We plan to allow PUT requests to create/update both custom traits
    and custom resource classes, without bodies. Prior to this change,
    the code would not all a PUT, POST or PATCH to not have a body. This was
    added in I6e7dffb5dc5f0cdc78a57e8df3ae9952c55163ae which was fixing an
    issue with how webob handles exceptions.
    
    This change does two things:
    
    * It address the problem from bug #1623517, fixed in the change id'd
      above, in a more narrow fashion, making sure the data source that
      causes the KeyError is non-empty right before it is used. This allows
      simplifying the following change.
    * If a request has a content-length (indicating the presence of a body),
      verify that there is also a content-type. If not, raise a 400.
    
    basic-http.yaml has been change to modify one gabbi test to check a
    response body is correct and to add another test to confirm that the
    code that is doing the content-length check is passed through.
    
    Change-Id: Ifb7446fd02ba3e54bbe2676dfd38e5dfecd15f98
    Closes-Bug: #1674392
    Related-Bug: #1623517


** 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/1674392

Title:
  placement api requires content-type on put and post even when no body

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  The placement API a guarding condition which checks the request
  method. If it is PUT, POST or PATCH the presence of a content-type
  header is required.

  This is too strict (but happened to work fine for the api at the
  time). It is reasonable and okay to make a PUT or POST without a body,
  and thus without a content-type, and now we want to do such things
  within the placement API (with putting custom traits and resource
  classes).

  The fix is to only raise the 400 when content-length is set and non-
  zero. In that case a missing content-type is a bug, irrespective of
  method.

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


References