From 3298fe78a1b6e3f68ae8bf4b91a937af05a10cfc Mon Sep 17 00:00:00 2001 From: Christoph Albers Date: Fri, 12 Feb 2016 18:54:14 +0100 Subject: [PATCH] invert the order of endpoint and bind_service attributes * endpoint type (admin, internal, public) and service (identitiy, network etc.) was switched during refactoring, this patch reverts this unintended switching * edited bind_service service type from public,internal,admin to 'all' for default binding to just one service * use bind_address method from common Change-Id: I4f97b659361dabd7fac216305d2aad2f1bb98f51 Depends-On: Iec485deaf415e4187a323435cce2b6bbadfc5d42 Depends-On: Ia5bddfc5e2fd77cd6e9e855c680b079f78fc1c3f --- attributes/default.rb | 19 ++++++++++--------- recipes/api.rb | 5 +++-- recipes/registry.rb | 5 +++-- spec/identity_registration_spec.rb | 12 ++++++------ 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/attributes/default.rb b/attributes/default.rb index 3e5146d..dfef7e6 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -142,14 +142,15 @@ end # The OpenStack Image (Glance) endpoints %w(public internal admin).each do |ep_type| %w(image_api image_registry).each do |service| - default['openstack']['endpoints'][service][ep_type]['scheme'] = 'http' - default['openstack']['endpoints']['image_api'][ep_type]['path'] = '' - default['openstack']['endpoints']['image_registry'][ep_type]['path'] = '/v2' - end - %w(endpoints bind_service).each do |type| - default['openstack'][type]['image_registry'][ep_type]['host'] = '127.0.0.1' - default['openstack'][type]['image_registry'][ep_type]['port'] = 9191 - default['openstack'][type]['image_api'][ep_type]['host'] = '127.0.0.1' - default['openstack'][type]['image_api'][ep_type]['port'] = 9292 + default['openstack']['endpoints'][ep_type][service]['scheme'] = 'http' + default['openstack']['endpoints'][ep_type][service]['host'] = '127.0.0.1' + default['openstack']['endpoints'][ep_type]['image_api']['path'] = '' + default['openstack']['endpoints'][ep_type]['image_api']['port'] = 9292 + default['openstack']['endpoints'][ep_type]['image_registry']['path'] = '/v2' + default['openstack']['endpoints'][ep_type]['image_registry']['port'] = 9191 end end +default['openstack']['bind_service']['all']['image_registry']['host'] = '127.0.0.1' +default['openstack']['bind_service']['all']['image_registry']['port'] = 9191 +default['openstack']['bind_service']['all']['image_api']['host'] = '127.0.0.1' +default['openstack']['bind_service']['all']['image_api']['port'] = 9292 diff --git a/recipes/api.rb b/recipes/api.rb index cf215d2..7366138 100644 --- a/recipes/api.rb +++ b/recipes/api.rb @@ -87,11 +87,12 @@ if node['openstack']['image_api']['conf']['DEFAULT']['rpc_backend'] == 'rabbit' end registry_endpoint = internal_endpoint 'image_registry' -api_bind = node['openstack']['bind_service']['image_api']['internal'] +api_bind = node['openstack']['bind_service']['all']['image_api'] +api_bind_address = bind_address api_bind node.default['openstack']['image_api']['conf'].tap do |conf| # [DEFAULT] section - conf['DEFAULT']['bind_host'] = api_bind.host + conf['DEFAULT']['bind_host'] = api_bind_address conf['DEFAULT']['bind_port'] = api_bind.port conf['DEFAULT']['registry_host'] = registry_endpoint.host conf['DEFAULT']['registry_port'] = registry_endpoint.port diff --git a/recipes/registry.rb b/recipes/registry.rb index 8eb0441..81a67be 100644 --- a/recipes/registry.rb +++ b/recipes/registry.rb @@ -51,7 +51,8 @@ if node['openstack']['image_registry']['conf']['DEFAULT']['rpc_backend'] == 'rab end identity_endpoint = public_endpoint 'identity' -registry_bind = node['openstack']['bind_service']['image_registry']['internal'] +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'] = @@ -90,7 +91,7 @@ end node.default['openstack']['image_registry']['conf'].tap do |conf| # [DEFAULT] section - conf['DEFAULT']['bind_host'] = registry_bind.host + conf['DEFAULT']['bind_host'] = registry_bind_address conf['DEFAULT']['bind_port'] = registry_bind.port # [keystone_authtoken] section diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb index d087bc6..e95b269 100644 --- a/spec/identity_registration_spec.rb +++ b/spec/identity_registration_spec.rb @@ -40,7 +40,7 @@ describe 'openstack-image::identity_registration' do it 'with different public url' do public_url = 'https://public.host:123/public_path' - node.set['openstack']['endpoints']['image_api']['public']['uri'] = public_url + node.set['openstack']['endpoints']['public']['image_api']['uri'] = public_url expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint') .with(auth_uri: 'http://127.0.0.1:35357/v2.0', bootstrap_token: 'bootstrap-token', @@ -54,7 +54,7 @@ describe 'openstack-image::identity_registration' do it 'with different admin url' do admin_url = 'http://admin.host:456/admin_path' - node.set['openstack']['endpoints']['image_api']['admin']['uri'] = admin_url + node.set['openstack']['endpoints']['admin']['image_api']['uri'] = admin_url expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint') .with(auth_uri: 'http://127.0.0.1:35357/v2.0', bootstrap_token: 'bootstrap-token', @@ -68,7 +68,7 @@ describe 'openstack-image::identity_registration' do it 'with different internal url' do internal_url = 'http://internal.host:789/internal_path' - node.set['openstack']['endpoints']['image_api']['internal']['uri'] = internal_url + node.set['openstack']['endpoints']['internal']['image_api']['uri'] = internal_url expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint') .with(auth_uri: 'http://127.0.0.1:35357/v2.0', bootstrap_token: 'bootstrap-token', @@ -84,9 +84,9 @@ describe 'openstack-image::identity_registration' do internal_url = 'http://internal.host:789/internal_path' admin_url = 'http://admin.host:456/admin_path' public_url = 'https://public.host:123/public_path' - node.set['openstack']['endpoints']['image_api']['internal']['uri'] = internal_url - node.set['openstack']['endpoints']['image_api']['admin']['uri'] = admin_url - node.set['openstack']['endpoints']['image_api']['public']['uri'] = public_url + node.set['openstack']['endpoints']['internal']['image_api']['uri'] = internal_url + node.set['openstack']['endpoints']['admin']['image_api']['uri'] = admin_url + node.set['openstack']['endpoints']['public']['image_api']['uri'] = public_url expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint') .with(auth_uri: 'http://127.0.0.1:35357/v2.0', bootstrap_token: 'bootstrap-token',