fog-openstack icon indicating copy to clipboard operation
fog-openstack copied to clipboard

Problem with number values in connection_params

Open vadimstroganov opened this issue 6 years ago • 3 comments
trafficstars

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?

vadimstroganov avatar Jan 31 '19 12:01 vadimstroganov

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

cyrylas avatar Feb 05 '19 19:02 cyrylas

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

vadimstroganov avatar Feb 05 '19 19:02 vadimstroganov

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

vadimstroganov avatar Feb 05 '19 19:02 vadimstroganov