From 21f820324a65679c4e7be988b8a22bf9f3e97683 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..465fd383 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 endpoint returned is v2 but v3 should be used + if @openstack_auth_url =~ /\/v3(\/)*$/ and @openstack_management_url !~ /\/v3(\/)*$/ + @openstack_management_url = @openstack_auth_url + end + @current_user = token.user['name'] @current_user_id = token.user['id'] @current_tenant = token.tenant