Use identity_uri_transform
Remove deprecated keys and use identity_uri via the new transform helper method. Also, cleanup specs for endpoint testing to make sure Common is fully tested. Change-Id: I5a26d8cb83193e4bf66bb952f7973838d6acba40 Implements: blueprint identity-uri
This commit is contained in:
		
				
					committed by
					
						
						Ma Wen Cheng
					
				
			
			
				
	
			
			
			
						parent
						
							440f32f4fb
						
					
				
				
					commit
					ab8aa01421
				
			@@ -91,6 +91,7 @@ identity_admin_endpoint = admin_endpoint 'identity-admin'
 | 
				
			|||||||
service_pass = get_password 'service', 'openstack-block-storage'
 | 
					service_pass = get_password 'service', 'openstack-block-storage'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auth_uri = auth_uri_transform(identity_endpoint.to_s, node['openstack']['block-storage']['api']['auth']['version'])
 | 
					auth_uri = auth_uri_transform(identity_endpoint.to_s, node['openstack']['block-storage']['api']['auth']['version'])
 | 
				
			||||||
 | 
					identity_uri = identity_uri_transform(identity_admin_endpoint)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template '/etc/cinder/cinder.conf' do
 | 
					template '/etc/cinder/cinder.conf' do
 | 
				
			||||||
  source 'cinder.conf.erb'
 | 
					  source 'cinder.conf.erb'
 | 
				
			||||||
@@ -115,7 +116,7 @@ template '/etc/cinder/cinder.conf' do
 | 
				
			|||||||
    enabled_drivers: enabled_drivers,
 | 
					    enabled_drivers: enabled_drivers,
 | 
				
			||||||
    multi_backend_sections: multi_backend_sections,
 | 
					    multi_backend_sections: multi_backend_sections,
 | 
				
			||||||
    auth_uri: auth_uri,
 | 
					    auth_uri: auth_uri,
 | 
				
			||||||
    identity_admin_endpoint: identity_admin_endpoint,
 | 
					    identity_uri: identity_uri,
 | 
				
			||||||
    service_pass: service_pass
 | 
					    service_pass: service_pass
 | 
				
			||||||
  )
 | 
					  )
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,21 +42,6 @@ describe 'openstack-block-storage::cinder-common' do
 | 
				
			|||||||
      let(:file) { chef_run.template('/etc/cinder/cinder.conf') }
 | 
					      let(:file) { chef_run.template('/etc/cinder/cinder.conf') }
 | 
				
			||||||
      let(:test_pass) { 'test_pass' }
 | 
					      let(:test_pass) { 'test_pass' }
 | 
				
			||||||
      before do
 | 
					      before do
 | 
				
			||||||
        endpoint = double(port: 'port', host: 'host', scheme: 'scheme')
 | 
					 | 
				
			||||||
        allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
 | 
					 | 
				
			||||||
          .with('image-api')
 | 
					 | 
				
			||||||
          .and_return(endpoint)
 | 
					 | 
				
			||||||
        allow_any_instance_of(Chef::Recipe).to receive(:admin_endpoint)
 | 
					 | 
				
			||||||
          .with('identity-admin')
 | 
					 | 
				
			||||||
          .and_return(endpoint)
 | 
					 | 
				
			||||||
        allow_any_instance_of(Chef::Recipe).to receive(:internal_endpoint)
 | 
					 | 
				
			||||||
          .with('identity-internal')
 | 
					 | 
				
			||||||
          .and_return(endpoint)
 | 
					 | 
				
			||||||
        allow_any_instance_of(Chef::Recipe).to receive(:endpoint)
 | 
					 | 
				
			||||||
          .with('block-storage-api-bind')
 | 
					 | 
				
			||||||
          .and_return(endpoint)
 | 
					 | 
				
			||||||
        allow_any_instance_of(Chef::Recipe).to receive(:auth_uri_transform)
 | 
					 | 
				
			||||||
          .and_return('auth_uri_transform')
 | 
					 | 
				
			||||||
        allow_any_instance_of(Chef::Recipe).to receive(:get_password)
 | 
					        allow_any_instance_of(Chef::Recipe).to receive(:get_password)
 | 
				
			||||||
          .with('user', anything)
 | 
					          .with('user', anything)
 | 
				
			||||||
          .and_return(test_pass)
 | 
					          .and_return(test_pass)
 | 
				
			||||||
@@ -141,19 +126,11 @@ describe 'openstack-block-storage::cinder-common' do
 | 
				
			|||||||
        context 'endpoint related' do
 | 
					        context 'endpoint related' do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          it 'has auth_uri' do
 | 
					          it 'has auth_uri' do
 | 
				
			||||||
            expect(chef_run).to render_file(file.name).with_content(/^auth_uri = auth_uri_transform$/)
 | 
					            expect(chef_run).to render_file(file.name).with_content(%r(^auth_uri = http://127.0.0.1:5000/v2.0$))
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          it 'has auth_host' do
 | 
					          it 'has identity_uri' do
 | 
				
			||||||
            expect(chef_run).to render_file(file.name).with_content(/^auth_host = host$/)
 | 
					            expect(chef_run).to render_file(file.name).with_content(%r(^identity_uri = http://127.0.0.1:35357/$))
 | 
				
			||||||
          end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          it 'has auth_port' do
 | 
					 | 
				
			||||||
            expect(chef_run).to render_file(file.name).with_content(/^auth_port = port$/)
 | 
					 | 
				
			||||||
          end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
          it 'has auth_protocol' do
 | 
					 | 
				
			||||||
            expect(chef_run).to render_file(file.name).with_content(/^auth_protocol = scheme$/)
 | 
					 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -263,7 +240,7 @@ describe 'openstack-block-storage::cinder-common' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        context 'glance endpoint' do
 | 
					        context 'glance endpoint' do
 | 
				
			||||||
          it 'has a glance_api_servers attribute' do
 | 
					          it 'has a glance_api_servers attribute' do
 | 
				
			||||||
            expect(chef_run).to render_file(file.name).with_content(%r{^glance_api_servers=scheme://host:port$})
 | 
					            expect(chef_run).to render_file(file.name).with_content(%r{^glance_api_servers=http://127.0.0.1:9292$})
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          it 'has glance_api_version attribute' do
 | 
					          it 'has glance_api_version attribute' do
 | 
				
			||||||
@@ -288,10 +265,12 @@ describe 'openstack-block-storage::cinder-common' do
 | 
				
			|||||||
            expect(chef_run).to render_file(file.name).with_content(%r{^glance_ca_certificates_file=dir/to/path$})
 | 
					            expect(chef_run).to render_file(file.name).with_content(%r{^glance_ca_certificates_file=dir/to/path$})
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          %w(host port).each do |glance_attr|
 | 
					          it 'has a glance host attribute' do
 | 
				
			||||||
            it "has a glance #{glance_attr} attribute" do
 | 
					            expect(chef_run).to render_file(file.name).with_content(/^glance_host=127.0.0.1$/)
 | 
				
			||||||
              expect(chef_run).to render_file(file.name).with_content(/^glance_#{glance_attr}=#{glance_attr}$/)
 | 
					 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          it 'has a glance port attribute' do
 | 
				
			||||||
 | 
					            expect(chef_run).to render_file(file.name).with_content(/^glance_port=9292$/)
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -302,11 +281,11 @@ describe 'openstack-block-storage::cinder-common' do
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        context 'cinder endpoint' do
 | 
					        context 'cinder endpoint' do
 | 
				
			||||||
          it 'has osapi_volume_listen set' do
 | 
					          it 'has osapi_volume_listen set' do
 | 
				
			||||||
            expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen=host$/)
 | 
					            expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen=127.0.0.1$/)
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          it 'has osapi_volume_listen_port set' do
 | 
					          it 'has osapi_volume_listen_port set' do
 | 
				
			||||||
            expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen_port=port$/)
 | 
					            expect(chef_run).to render_file(file.name).with_content(/^osapi_volume_listen_port=8776$/)
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1080,29 +1080,13 @@ enabled_backends = <%= @multi_backend_sections.keys.join(',') %>
 | 
				
			|||||||
# Options defined in keystonemiddleware.auth_token
 | 
					# Options defined in keystonemiddleware.auth_token
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Prefix to prepend at the beginning of the path. Deprecated,
 | 
					 | 
				
			||||||
# use identity_uri. (string value)
 | 
					 | 
				
			||||||
#auth_admin_prefix=
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Host providing the admin Identity API endpoint. Deprecated,
 | 
					 | 
				
			||||||
# use identity_uri. (string value)
 | 
					 | 
				
			||||||
auth_host = <%= @identity_admin_endpoint.host %>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Port of the admin Identity API endpoint. Deprecated, use
 | 
					 | 
				
			||||||
# identity_uri. (integer value)
 | 
					 | 
				
			||||||
auth_port = <%= @identity_admin_endpoint.port %>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Protocol of the admin Identity API endpoint (http or https).
 | 
					 | 
				
			||||||
# Deprecated, use identity_uri. (string value)
 | 
					 | 
				
			||||||
auth_protocol = <%= @identity_admin_endpoint.scheme %>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Complete public Identity API endpoint (string value)
 | 
					# Complete public Identity API endpoint (string value)
 | 
				
			||||||
auth_uri = <%= @auth_uri %>
 | 
					auth_uri = <%= @auth_uri %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Complete admin Identity API endpoint. This should specify
 | 
					# Complete admin Identity API endpoint. This should specify
 | 
				
			||||||
# the unversioned root endpoint e.g. https://localhost:35357/
 | 
					# the unversioned root endpoint e.g. https://localhost:35357/
 | 
				
			||||||
# (string value)
 | 
					# (string value)
 | 
				
			||||||
#identity_uri=<None>
 | 
					identity_uri = <%= @identity_uri %>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# API version of the admin Identity API endpoint (string
 | 
					# API version of the admin Identity API endpoint (string
 | 
				
			||||||
# value)
 | 
					# value)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user