fog / fog-openstack

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

'No endpoint match' exception for Multiple region '*' #467

Open PratikAwchat opened 6 years ago

PratikAwchat commented 6 years ago

I am working on OpenStack based cloud, in which it supports multiple regions; getting region as * in response of type 'Identity'.

response:{"endpoints"=>[{"region_id"=>"*", "id"=>"h65y65456f54r5t565tg65t67515vjhf", "region"=>"*", "interface"=>"public", "url"=>"https://iam.sa-brazil-1.dummy_cloud_provider.com/v3"}], "name"=>"keystone", "id"=>"bdsg767t47ghjfbv474778jhbfvhb74j", "type"=>"identity"}"

Due to * in the "region", it throws exception: 'No endpoint match'. When i tried to replace * with region name 'sa-brazil-1', it works fine. Can you please guide for the same and let me know the purpose of *?

ShamoX commented 5 years ago

Hi, I have the same problem. In my opinion it is related to the fact that you can't connect to multiple regions when there is. You have to choose one. If you find a way to be able to detect all the regions, I'd like to know :) I wanted to create a region unrelated API for OpenStack but I need to pass the regions name as a parameter which kind of break the behavior I wanted...

ShamoX commented 5 years ago

Ok, I found a way. In the project we created for this purpose (managing multiple regions Openstack provider) I used the direct access to Fog::OpenStack::Auth::Token.build method to create a token that I keep, and then get the list of regions that the user has the right to access. This is managed in that file : https://gitlab.com/rol-public/openstack-router/blob/master/lib/openstack-router/catalog.rb

ShamoX commented 5 years ago

I'll need to test my code, so I begin to think about improving the MOCK of OpenStack to test some of the methods in this library (some code are uncovered, because the MOCK of Fog-openstack is not complete).

gildub commented 5 years ago

As far as I remember the region which is null by default must be specified if they are multiple regions. Basically if there is only one region the endpoint will be found without ambiguity (therefore the region doesn't matter) otherwise the region has to be specified.

From that being able to get all regions requires effectively a dedicated method.