SchedulerReportClient.put with empty (not None) payload errors 415
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Eric Fried |
Bug Description
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_
tags: | added: placement scheduler |
Changed in nova: | |
importance: | Undecided → Medium |
Fix proposed to branch: master /review. openstack. org/536545
Review: https:/