Merge "Add identity_uri_transform to help move to identity_uri"
This commit is contained in:
@@ -71,4 +71,15 @@ module ::Openstack # rubocop:disable Documentation
|
||||
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
|
||||
# admin identity endpoint e.g. https://localhost:35357/
|
||||
# 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
|
||||
|
@@ -117,4 +117,19 @@ describe 'Openstack uri' do
|
||||
).to eq(expected_auth_uri)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#identity_uri_transform' do
|
||||
it 'removes the path segment from identity admin endpoint' do
|
||||
expect(
|
||||
subject.identity_uri_transform('http://localhost:35357/v2.0')
|
||||
).to eq('http://localhost:35357/')
|
||||
end
|
||||
|
||||
it 'does not effect a valid identity admin endpoint' do
|
||||
identity_uri = 'http://localhost:35357/'
|
||||
expect(
|
||||
subject.identity_uri_transform(identity_uri)
|
||||
).to eq(identity_uri)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user