fog / fog-openstack

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

Problem with number values in connection_params #487

Open vadimstroganov opened 5 years ago

vadimstroganov commented 5 years ago

Hello!

I have a problem with the connection_params, if I specify values consisting only of numbers.

for-core call coerce_options for connection_params.

coerce_options suggests it takes a Hash and converts all the values to underlying Ruby types. So a username that is only numbers is converted to a number.

After the conversion, the string "12345" is converted to the number 12345. And after that, a request for authentication of OpenStack API is sent.

In this case, OpenStack API in the response body is an empty string.

Then an error occurs. (can't decode JSON; response.body = "")

https://github.com/fog/fog-openstack/blob/master/lib/fog/openstack/auth/token/v3.rb#L58

I already wrote about this here https://github.com/fog/fog-core/issues/247

Probably the best way would be to wrap the parameters after call coerce_options into a string?

cyrylas commented 5 years ago

Is that related to #426? I think I have already fixed that.

vadimstroganov commented 5 years ago

No, https://github.com/fog/fog-openstack/pull/426 about tenantId and tenantName keys. My problem arises with openstack_ keys.

vadimstroganov commented 5 years ago

In https://github.com/fog/fog-openstack/pull/488 for the keys starting with openstack_ I call a conversion to string.