Add identity_uri_transform to help move to identity_uri
Starting on the identity_uri blueprint. A difference between the public auth_uri and the admin identity_uri is that the identity_uri does not include the path/version (/v2.0). And the auth_uri has to modify the version depending upon the needs of the environment. There existed a helper routine called, auth_uri_transform, so to be consistent and make this easy to follow, I created a identity_uri_transform which simply removes the path/version from the uri given. This helper will then be used thru out the cookbooks to make the switch to the identity_uri very easy. I guess the alturnatives are messing with our generic endpoint definitions/methods, but since they are used for many different purposes, I think having another matching transform method is the right way to go here. Bumped version for adding new method which other cookbooks will depend upon. Change-Id: I035a4491945c600dea8feb317b357a1a69da28cd Implements: blueprint identity-uri
This commit is contained in:
parent
79b561353f
commit
22d8885367
@ -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
|
||||
|
@ -4,7 +4,7 @@ maintainer_email 'opscode-chef-openstack@googlegroups.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Common OpenStack attributes, libraries and recipes.'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '11.0.0'
|
||||
version '11.1.0'
|
||||
|
||||
recipe 'openstack-common', 'Installs/Configures common recipes'
|
||||
recipe 'openstack-common::set_endpoints_by_interface', 'Set endpoints by interface'
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user