yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #70509
[Bug 1744786] [NEW] SchedulerReportClient.put with empty (not None) payload errors 415
Public bug reported:
https://github.com/openstack/nova/blob/f0d830d56d20c7f34372cd3c68d13a94bdf645a6/nova/scheduler/client/report.py#L295-L302
295 def put(self, url, data, version=None):
296 # NOTE(sdague): using json= instead of data= sets the
297 # media type to application/json for us. Placement API is
298 # more sensitive to this than other APIs in the OpenStack
299 # ecosystem.
300 kwargs = {'microversion': version}
301 if data:
302 kwargs['json'] = data
On line 301, if data is a False value other than None, we won't set the
json kwarg, so Session won't set the content type to application/json,
and we'll run afoul of:
<html>
<head>
<title>415 Unsupported Media Type</title>
</head>
<body>
<h1>415 Unsupported Media Type</h1>
The request media type None is not supported by this server.
<br /><br />
The media type None is not supported, use application/json
</body>
</html>
A normal "workaround" - which is being used for e.g. inventories - is
for the caller to check for "empty" and hit the DELETE API instead.
But we don't have a DELETE API for resource provider aggregates
(/resource_providers/{u}/aggregates).
** Affects: nova
Importance: Undecided
Status: New
--
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/1744786
Title:
SchedulerReportClient.put with empty (not None) payload errors 415
Status in OpenStack Compute (nova):
New
Bug description:
https://github.com/openstack/nova/blob/f0d830d56d20c7f34372cd3c68d13a94bdf645a6/nova/scheduler/client/report.py#L295-L302
295 def put(self, url, data, version=None):
296 # NOTE(sdague): using json= instead of data= sets the
297 # media type to application/json for us. Placement API is
298 # more sensitive to this than other APIs in the OpenStack
299 # ecosystem.
300 kwargs = {'microversion': version}
301 if data:
302 kwargs['json'] = data
On line 301, if data is a False value other than None, we won't set
the json kwarg, so Session won't set the content type to
application/json, and we'll run afoul of:
<html>
<head>
<title>415 Unsupported Media Type</title>
</head>
<body>
<h1>415 Unsupported Media Type</h1>
The request media type None is not supported by this server.
<br /><br />
The media type None is not supported, use application/json
</body>
</html>
A normal "workaround" - which is being used for e.g. inventories - is
for the caller to check for "empty" and hit the DELETE API instead.
But we don't have a DELETE API for resource provider aggregates
(/resource_providers/{u}/aggregates).
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1744786/+subscriptions
Follow ups