fog / fog-openstack

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

Multiple endpoints found (Fog::OpenStack::Auth::Catalog::EndpointError) - not sure how to resolve #509

Closed powerje closed 4 years ago

powerje commented 4 years ago

I am getting the following error when trying to use the Storage API:

gems/fog-openstack-1.0.10/lib/fog/openstack/auth/catalog.rb:68:in `get_endpoint': Multiple endpoints found (Fog::OpenStack::Auth::Catalog::EndpointError)

My code looks like:

@connection_params = {
  :openstack_auth_url   => "https://url.../auth/v2.0",
  :openstack_username   => "USERNAME",
  :openstack_tenant     => "TENANT_NAME",
  :openstack_api_key    => "KEY",
  :openstack_identity_api_version => "2.0",
}

thing = Fog::OpenStack::Storage.new(@connection_params)
p thing

I've added a print statement to catalog.rb see what endpoints are in the list:

      def get_endpoint(entries, interface, region)
        list = []
        entries.each do |type|
          next unless type.key?('endpoints')
          type['endpoints'].each do |endpoint|
            p "endpoint"
            p endpoint
            list << endpoint_url(endpoint, interface) if endpoint_match?(endpoint, interface, region)
          end
        end
        p "list"
        p list
        raise EndpointError, 'Multiple endpoints found' if list.size > 1
        list[0]
      end

Which outputs a list with 2 URLs which happen to be exactly the same, formatted like: https://url:443/v1/<TENANT_NAME>

Is this a problem on my OpenStack providers end? Is there something I can do to make it uses a specific element in the list (which in this case is arbitrary, as they are the same)?

powerje commented 4 years ago

Seems like I could be making the same mistake as in this issue: https://github.com/hashicorp/terraform/issues/3293 but I am using what I believe to be the correct auth URL (/v2.0)

ares commented 4 years ago

@powerje have you found the cause? Thanks

powerje commented 4 years ago

It’s my understanding that this is an issue with Swiftstack who manages my cloud hosts Swift instance. They haven’t fixed it yet but I’ve moved on to another solution.

ShamoX commented 4 years ago

On cluster that hosts multiple endpoints you need to specify which one you want to connect to, or you'll have to manage the catalog. Isn't it your problem ? I think you need to add openstack_region key to specify the region on which you want to work on. Or you can do like I did on a project where I wanted to manage multiple endpoint see this issue: #467