Update identity endpoint handling

- Use the internal endpoint like in the identity cookbook
- Drop the api auth version attribute

Change-Id: I99c55bcd4451d4cac2c127ccad0dc471fc641be0
This commit is contained in:
Jens Harbott 2019-04-30 13:53:37 +00:00
parent 53310d6c7d
commit ef8d213673
2 changed files with 22 additions and 22 deletions

View File

@ -17,6 +17,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
require 'uri'
class Chef::Recipe
include ::Openstack
end
@ -35,8 +37,8 @@ platform_options['tempest_packages'].each do |pkg|
end
end
identity_endpoint = public_endpoint 'identity'
auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version']
identity_endpoint = internal_endpoint 'identity'
auth_url = ::URI.decode identity_endpoint.to_s
admin_user = node['openstack']['identity']['admin_user']
admin_pass = get_password 'user', admin_user
@ -44,12 +46,15 @@ admin_project = node['openstack']['identity']['admin_project']
admin_domain = node['openstack']['identity']['admin_domain_name']
admin_project_domain_name = node['openstack']['identity']['admin_project_domain']
endpoint_type = node['openstack']['identity']['endpoint_type']
connection_params = {
openstack_auth_url: "#{auth_url}/auth/tokens",
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_project_name: admin_project,
openstack_domain_name: admin_domain,
openstack_auth_url: "#{auth_url}/auth/tokens",
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_project_name: admin_project,
openstack_domain_name: admin_domain,
openstack_endpoint_type: endpoint_type,
}
%w(user1 user2).each_with_index do |user|
@ -147,8 +152,8 @@ end
node.default['openstack']['integration-test']['conf'].tap do |conf|
conf['compute']['image_ref'] = node['openstack']['integration-test']['image1']['id']
conf['compute']['image_ref_alt'] = node['openstack']['integration-test']['image2']['id']
conf['identity']['uri'] = "#{identity_endpoint.scheme}://#{identity_endpoint.host}:#{identity_endpoint.port}/v3/"
conf['identity']['uri_v3'] = "#{identity_endpoint.scheme}://#{identity_endpoint.host}:#{identity_endpoint.port}/v3/"
conf['identity']['uri_v3'] = identity_endpoint.to_s
conf['identity']['v3_endpoint_type'] = endpoint_type
end
node.default['openstack']['integration-test']['conf_secrets'].tap do |conf_secrets|

View File

@ -17,6 +17,7 @@ describe 'openstack-integration-test::setup' do
openstack_api_key: 'admin',
openstack_project_name: 'admin',
openstack_domain_name: 'default',
openstack_endpoint_type: 'internalURL',
}
it 'installs tempest dependencies' do
@ -151,18 +152,18 @@ describe 'openstack-integration-test::setup' do
)
end
it 'has an auth URI with the default scheme' do
expect(chef_run).to render_file(file.name).with_content(
'uri = http://127.0.0.1:5000/v3'
)
end
it 'has a v3 auth URI with the default scheme' do
expect(chef_run).to render_file(file.name).with_content(
'uri_v3 = http://127.0.0.1:5000/v3'
)
end
it 'has an endpoint type matching the default value' do
expect(chef_run).to render_file(file.name).with_content(
'endpoint_type = internalURL'
)
end
it 'discovers compute hosts' do
expect(chef_run).to run_execute('discover_hosts')
.with(user: 'nova',
@ -173,17 +174,11 @@ describe 'openstack-integration-test::setup' do
describe 'tempest.conf with HTTPS' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:chef_run) do
runner.node.override['openstack']['endpoints']['public']['identity']['scheme'] = 'https'
runner.node.override['openstack']['endpoints']['internal']['identity']['scheme'] = 'https'
runner.converge(described_recipe)
end
let(:file) { chef_run.template('/opt/tempest/etc/tempest.conf') }
it 'has an auth URI with the secure scheme' do
expect(chef_run).to render_file(file.name).with_content(
'uri = https://127.0.0.1:5000/v3'
)
end
it 'has a v3 auth URI with the secure scheme' do
expect(chef_run).to render_file(file.name).with_content(
'uri_v3 = https://127.0.0.1:5000/v3'