yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #73129
[Bug 1771384] Re: placement api send text/html error responses when accept headers is '*/*'
Reviewed: https://review.openstack.org/568630
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=44e2d7ae8bb82d7a3b4ec3d22cafd44d2f8e026a
Submitter: Zuul
Branch: master
commit 44e2d7ae8bb82d7a3b4ec3d22cafd44d2f8e026a
Author: Chris Dent <cdent@xxxxxxxxxxxxx>
Date: Tue May 15 16:55:42 2018 +0100
[placement] default to accept of application/json when */*
In change Ice27c7080fc2df097cb387f7438c0aaf32b4c63d the placement api
was changed to set the accept header to application/json if the accept
header was not set. This was done to ensure that error responses are
formatted as JSON in the face of automation that webob does when
formatting errors.
That change was incomplete. Apparently many clients, notably requests,
which backs keystoneauth1, sets a default Accept header of '*/*'. This
is a reasonable default but means our error formatting default can go
awry.
This fixes it in the simplest way possible. See the referenced change
above for discussion on why doing this with a microversion would be
pointless.
Tested with a simple gabbi confirmation.
Change-Id: I3df5b9fb8fe7c0e41f7e1f495758973423485e11
Closes-Bug: #1771384
** 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/1771384
Title:
placement api send text/html error responses when accept headers is
'*/*'
Status in OpenStack Compute (nova):
Fix Released
Bug description:
In change https://review.openstack.org/#/c/518223/ the placement
service was adjusted to default to application/json as the accept
header when no accept header is present. This was done to control the
automatic content negotiation that webob does for formatting error
responses. By default, it wants to send text/html error responses,
which we do not want in placement.
Unfortunately, the fix in that change is incomplete. If a client sends
'*/*' as the accept header, what they are saying is "we'll take
whatever you want to send". Since the above fix is trying to say "the
default is JSON" we should consider '*/*' as 'application/json'.
We can fix this relatively easily and without impact on the error
processing that inspects error strings, as the strings will remain the
same. In some cases, they will have a different format.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1771384/+subscriptions
References