diff --git a/recipes/api.rb b/recipes/api.rb index 8611194..410be71 100644 --- a/recipes/api.rb +++ b/recipes/api.rb @@ -64,11 +64,11 @@ if node['openstack']['image_api']['conf']['glance_store']['default_store'] == 'f end end -identity_endpoint = public_endpoint 'identity' node.default['openstack']['image_api']['conf_secrets'] .[]('keystone_authtoken')['password'] = get_password 'service', 'openstack-image' +identity_endpoint = public_endpoint 'identity' auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version'] db_user = node['openstack']['db']['image']['username'] diff --git a/recipes/identity_registration.rb b/recipes/identity_registration.rb index 7457f22..ff6d37f 100644 --- a/recipes/identity_registration.rb +++ b/recipes/identity_registration.rb @@ -26,9 +26,8 @@ class ::Chef::Recipe include ::Openstack end -identity_admin_endpoint = admin_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'] interfaces = { public: { url: public_endpoint('image_api') }, diff --git a/recipes/image_upload.rb b/recipes/image_upload.rb index a693a99..7edfd6b 100644 --- a/recipes/image_upload.rb +++ b/recipes/image_upload.rb @@ -32,7 +32,9 @@ package 'curl' do action :upgrade end -auth_uri = public_endpoint('identity').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']['image_api']['conf']['keystone_authtoken']['username'] # admin_pass = get_password admin_user, admin_pass admin_user = node['openstack']['identity']['admin_user'] @@ -55,7 +57,7 @@ node['openstack']['image']['upload_images'].each do |img| identity_user admin_user identity_pass admin_pass identity_tenant admin_project_name - identity_uri auth_uri + identity_uri auth_url identity_user_domain_name admin_domain identity_project_domain_name admin_project_domain_name action :upload diff --git a/recipes/registry.rb b/recipes/registry.rb index 2dd4c85..9a0cd3b 100644 --- a/recipes/registry.rb +++ b/recipes/registry.rb @@ -39,14 +39,15 @@ if node['openstack']['mq']['service_type'] == 'rabbit' node.default['openstack']['image_registry']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'image' end -identity_endpoint = public_endpoint 'identity' registry_bind = node['openstack']['bind_service']['all']['image_registry'] registry_bind_address = bind_address registry_bind node.default['openstack']['image_registry']['conf_secrets'] .[]('keystone_authtoken')['password'] = get_password 'service', 'openstack-image' +identity_endpoint = public_endpoint 'identity' auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version'] + glance_user = node['openstack']['image']['user'] glance_group = node['openstack']['image']['group'] diff --git a/recipes/swift_store.rb b/recipes/swift_store.rb index 659674b..7c845c0 100644 --- a/recipes/swift_store.rb +++ b/recipes/swift_store.rb @@ -29,8 +29,7 @@ platform_options['swift_packages'].each do |pkg| end identity_endpoint = public_endpoint 'identity' -swift_store_auth_address = - auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version'] +swift_store_auth_address = ::URI.decode identity_endpoint.to_s tenant = node['openstack']['image_api']['conf']['keystone_authtoken']['project'] user = node['openstack']['image_api']['conf']['keystone_authtoken']['user'] swift_store_user = "#{tenant}_#{user}" diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb index bb8d848..b43734d 100644 --- a/spec/identity_registration_spec.rb +++ b/spec/identity_registration_spec.rb @@ -11,7 +11,7 @@ describe 'openstack-image::identity_registration' do include_context 'image-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-pass', openstack_project_name: 'admin', diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 96a280f..b89bf61 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,16 +6,19 @@ ChefSpec::Coverage.start! { add_filter 'openstack-image' } 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 # Helper methods @@ -166,12 +169,8 @@ shared_examples 'syslog use' do end shared_examples 'keystone attribute setter' do |version| - it 'sets the auth_uri value' do - expect(chef_run).to render_file(file.name).with_content(%r{^auth_uri = http://127.0.0.1:5000/v3$}) - end - it 'sets the identity_uri value' do - expect(chef_run).to render_file(file.name).with_content(%r{^identity_uri = http://127.0.0.1:35357/$}) + expect(chef_run).to render_file(file.name).with_content(%r{^identity_uri = http://127.0.0.1:5000/$}) end context 'auth version' do