"heat stack-create" is getting failed with HTTP error code 415 due to missing HTTP header
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-heatclient |
New
|
Undecided
|
Unassigned |
Bug Description
The latest openstack heat client (1.5.0) has a bug which will not allow the user to create the stack. After examining the source code of it, it is basically creating a HTTP POST request but with a missing HTTP header.
I have added it to the source code of heat client and verified that heat create is working fine.
Issue:
"Content-Type: application/json" header is missing in the curl request header and results in HTTP 415 response code.
$ heat --debug stack-create networks -f network_create.yml
DEBUG (connectionpool) "POST /v1/f8672940d89
DEBUG (session) RESP: [415] Date: Wed, 02 Nov 2016 02:06:45 GMT Via: 1.1 Repose (Repose/7.1.4.0) x-trans-id: 48ce78c7-
Traceback (most recent call last):
File "/usr/local/
sys.
File "/usr/local/
HeatShell(
File "/usr/local/
args.
File "/usr/local/
hc.
File "/usr/local/
data=kwargs, headers=headers)
File "/usr/local/
return self.request(url, 'POST', **kwargs)
File "/usr/local/
raise exc.from_
heatclient.
Proposed Fix:
Add "Content-Type: application/json" in adapter.py script of keystoneauth1 module.
#!/usr/bin/env python
import sys
try:
import keystoneauth1
except ImportError:
print "Please run this script after installing openstack clients"
sys.exit(2)
import fileinput
import os
def main():
path = os.path.
check = False
for line in fileinput.
if line.find(
check = True
else:
if line.find('Accept') != -1 and not check:
print line,
if __name__ == '__main__':
main()
Please find the diff:
--- a/usr/local/ lib/python2. 7/dist- packages/ keystoneauth1/ adapter. py 2017-05-17 09:09:44.531448269 -0400 lib/python2. 7/dist- packages/ keystoneauth1/ adapter. py 2017-05-17 09:07:22.038628580 -0400
+++ b/usr/local/
@@ -372,6 +372,7 @@
def request(self, *args, **kwargs): setdefault( 'headers' , {}) setdefault( 'Content- Type', 'application/json')
headers. setdefault( 'Accept' , 'application/json')
headers = kwargs.
+ headers.
try: