From 9b67abe1d8f8fe368e5089d9ab083f48d20578a1 Mon Sep 17 00:00:00 2001 From: Samuel Cassiba Date: Tue, 12 Jun 2018 22:15:12 -0700 Subject: [PATCH] Simplify identity endpoint Per the Keystone Install Guide[1] the admin endpoint is superseded in favor of a single public endpoint. As a result, the admin endpoint is no longer deployed by default. [1] https://docs.openstack.org/keystone/queens/install/keystone-install-ubuntu.html#install-and-configure-components Change-Id: I06d0f98e641a041ddc864f524858edc0cffbbbba Implements: blueprint simplify-identity-endpoint --- recipes/setup.rb | 13 ++++++------- spec/setup_spec.rb | 14 +++++++------- spec/spec_helper.rb | 13 ++++++++----- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/recipes/setup.rb b/recipes/setup.rb index eb10608..39592f3 100644 --- a/recipes/setup.rb +++ b/recipes/setup.rb @@ -35,9 +35,8 @@ platform_options['tempest_packages'].each do |pkg| end end -identity_admin_endpoint = admin_endpoint 'identity' -identity_public_endpoint = public_endpoint 'identity' -auth_url = ::URI.decode identity_admin_endpoint.to_s +identity_endpoint = public_endpoint 'identity' +auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version'] admin_user = node['openstack']['identity']['admin_user'] admin_pass = get_password 'user', admin_user @@ -133,9 +132,9 @@ ruby_block 'Create nano flavor 99' do block do begin env = openstack_command_env(admin_user, admin_project, 'Default', 'Default') - output = openstack_command('nova', 'flavor-list', env) + output = openstack_command('openstack', 'flavor list', env) unless output.include? 'm1.nano' - openstack_command('nova', 'flavor-create m1.nano 99 64 0 1', env) + openstack_command('openstack', 'flavor create --id 99 --vcpus 1 --ram 64 --disk 1 m1.nano', env) end rescue RuntimeError => e Chef::Log.error("Could not create flavor m1.nano. Error was #{e.message}") @@ -146,8 +145,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_public_endpoint.scheme}://#{identity_public_endpoint.host}:#{identity_public_endpoint.port}/v2.0/" - conf['identity']['uri_v3'] = "#{identity_public_endpoint.scheme}://#{identity_public_endpoint.host}:#{identity_public_endpoint.port}/v3/" + 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/" end node.default['openstack']['integration-test']['conf_secrets'].tap do |conf_secrets| diff --git a/spec/setup_spec.rb b/spec/setup_spec.rb index ec4d700..06636bb 100644 --- a/spec/setup_spec.rb +++ b/spec/setup_spec.rb @@ -12,7 +12,7 @@ describe 'openstack-integration-test::setup' do include_context 'tempest-stubs' connection_params = { - openstack_auth_url: 'http://127.0.0.1:35357/v3/auth/tokens', + openstack_auth_url: 'http://127.0.0.1:5000/v3/auth/tokens', openstack_username: 'admin', openstack_api_key: 'admin', openstack_project_name: 'admin', @@ -105,7 +105,7 @@ describe 'openstack-integration-test::setup' do identity_user: 'admin', identity_pass: 'admin', identity_tenant: 'admin', - identity_uri: 'http://127.0.0.1:35357/v3', + identity_uri: 'http://127.0.0.1:5000/v3', identity_user_domain_name: 'default', identity_project_domain_name: 'default', image_name: 'cirros-test1', @@ -119,7 +119,7 @@ describe 'openstack-integration-test::setup' do identity_user: 'admin', identity_pass: 'admin', identity_tenant: 'admin', - identity_uri: 'http://127.0.0.1:35357/v3', + identity_uri: 'http://127.0.0.1:5000/v3', identity_user_domain_name: 'default', identity_project_domain_name: 'default', image_name: 'cirros-test2', @@ -151,9 +151,9 @@ describe 'openstack-integration-test::setup' do ) end - it 'has a v2 auth URI with the default scheme' do + 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/v2.0' + 'uri = http://127.0.0.1:5000/v3' ) end @@ -178,9 +178,9 @@ describe 'openstack-integration-test::setup' do end let(:file) { chef_run.template('/opt/tempest/etc/tempest.conf') } - it 'has a v2 auth URI with the secure scheme' do + 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/v2.0' + 'uri = https://127.0.0.1:5000/v3' ) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a2e289e..719dc90 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,16 +6,19 @@ ChefSpec::Coverage.start! { add_filter 'openstack-integration-test' } require 'chef/application' -LOG_LEVEL = :fatal +RSpec.configure do |config| + config.color = true + config.formatter = :documentation + config.log_level = :fatal +end + REDHAT_OPTS = { platform: 'redhat', - version: '7.3', - log_level: LOG_LEVEL, + version: '7.4', }.freeze UBUNTU_OPTS = { platform: 'ubuntu', version: '16.04', - log_level: LOG_LEVEL, }.freeze shared_context 'tempest-stubs' do @@ -25,7 +28,7 @@ shared_context 'tempest-stubs' do 'OS_USERNAME' => 'admin', 'OS_PASSWORD' => 'admin', 'OS_PROJECT_NAME' => 'admin', - 'OS_AUTH_URL' => 'http://127.0.0.1:35357/v3', + 'OS_AUTH_URL' => 'http://127.0.0.1:5000/v3', 'OS_USER_DOMAIN_NAME' => 'default', 'OS_PROJECT_DOMAIN_NAME' => 'default', 'OS_IDENTITY_API_VERSION' => 3,