fog / fog-openstack

Fog for OpenStack Platform
MIT License
68 stars 130 forks source link

Suggest to modify fog‘s check on response header #227

Open zhutao11 opened 7 years ago

zhutao11 commented 7 years ago

Background: 1.openstack version : Juno 2.Fail to deploy cloudfoundry 3.Ruby:2.2.3 Workaround: Login in Bosh-director VM ,and the modify the code in "/var/vcap/packages/registry/gem_home/ruby/2.3.0/gems/fog-openstack-0.1.7/lib/fog/openstack/compute.rb" Modifation: Insert a "#" to comment the code to check the responese header if !response.body.empty? && response.get_header('Content-Type') == 'application/json response.body = Fog::JSON.decode(respinse.body) end

Actually, the "responese header" issue exists at multiple place in Fog's code. Expectation: My openstack API’s response header must contains "Content-Type"=>"application/json; charset=UTF-8". I think is reasonable ,where “charset=UTF-8” contributes to response analysis. While the fog's check is too strick to continue the CF deployment. So I need a help to solve this issue.

Addtion: It's not the openstack's issue. The response from openstack will be handled at Web Server,and the UTF-8 in header comes from Tomcat. I think the UTF-8 contributes to response analysis, but should not be a limit.

Thank you very much!!!

voelzmo commented 7 years ago

As discussed in https://github.com/cloudfoundry/bosh/issues/1495 and https://github.com/cloudfoundry/bosh/issues/1501: OpenStack doesn't add charset to the content-type header. Nova even has a test for this https://github.com/openstack/nova/blob/5158ca7dcffd583dc8dd7c29b0a9a595d7de7dcf/nova/tests/unit/api/openstack/test_wsgi.py#L63-L67

Please make sure that whatever webserver you have in the middle doesn't modify the content-type header.

Edit:

zhutao11 commented 7 years ago

Hi voelzmo, Thank you for your answer.

I know it's not a issue from openstack. The charset=UTF-8 comes from the Apache Tomcat default response, which makes contribute to different analysis tools.

I really like CF, and I think it's just a format issue.

If we take this scene with charset=UTF-8 into account. It's better to expand the application scope of CF.

Thank you very much!