Clean up URI handling

The two functions auth_uri_transform() and identity_uri_transform()
implicitly assume that the identity endpoint has no path component other
than 'v2.0'. This blocks modern deployment designs, so drop these
functions.

Probably will need some dependencies to clean up consumers of these
functions.

Change-Id: I711ff0c0f8d35c581d2a419debe50425ec0d51c2
This commit is contained in:
Jens Harbott 2019-05-06 08:52:00 +00:00
parent 6fd3db1717
commit 29e07f27b2
2 changed files with 0 additions and 40 deletions

View File

@ -49,29 +49,4 @@ module ::Openstack
paths.map! { |path| path.sub(%r{^\/+}, '').sub(%r{\/+$}, '') }
leadingslash + paths.join('/') + trailingslash
end
def auth_uri_transform(auth_uri, auth_version)
case auth_version
when 'v2.0'
auth_uri
when 'v3.0'
# The auth_uri should contain /v2.0 in most cases, but if the
# auth_version is v3.0, we set it to v3. This is only necessary
# for environments that need to support V3 non-default-domain
# tokens, which is really the only reason to set version to
# something other than v2.0 (the default)
auth_uri.gsub('/v2.0', '/v3')
end
end
# Helper for creating identity_uri value for the auth_token section
# of component config files.
# The definition of identity is: the unversioned root
# identity endpoint e.g. https://localhost:5000/
# This method will make sure the path is removed from the uri.
def identity_uri_transform(identity_uri)
uri = ::URI.parse ::URI.encode(identity_uri.to_s)
uri.path = '/'
uri.to_s
end
end

View File

@ -88,19 +88,4 @@ describe 'Openstack uri' do
).to eq(expected)
end
end
describe '#identity_uri_transform' do
it 'removes the path segment from identity endpoint' do
expect(
subject.identity_uri_transform('http://localhost:5000/v3')
).to eq('http://localhost:5000/')
end
it 'does not effect a valid identity endpoint' do
identity_uri = 'http://localhost:5000/'
expect(
subject.identity_uri_transform(identity_uri)
).to eq(identity_uri)
end
end
end