From ea8787db6b234a78c0fb431887e61f579f61bc6d Mon Sep 17 00:00:00 2001 From: Anthony Chevalet Date: Mon, 20 Jul 2020 12:19:40 +0200 Subject: [PATCH] Fix URLs to use v3 when only v2 endpoint is listed in the catalog It covers the cases where we can authenticate with keystone v3 but the endpoint returned in the catalog is v2 see https://github.com/fog/fog-openstack/issues/492 --- lib/fog/openstack/core.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/fog/openstack/core.rb b/lib/fog/openstack/core.rb index 86090e9b..4b838ff2 100644 --- a/lib/fog/openstack/core.rb +++ b/lib/fog/openstack/core.rb @@ -222,6 +222,11 @@ def authenticate @openstack_auth_url end + # Manages cases where identity endpoint returned is v2 but v3 should be used + if @openstack_service_type.include? 'identity_v3' and @openstack_management_url =~ /\/v2\.0(\/)*$/ + @openstack_management_url = @openstack_auth_url + end + @current_user = token.user['name'] @current_user_id = token.user['id'] @current_tenant = token.tenant