Merge "Clean up URI handling"

This commit is contained in:
Zuul 2019-07-30 13:06:07 +00:00 committed by Gerrit Code Review
commit e51294e5a2
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