Use new common specific_endpoint routines

Now that admin_endpoint, public_endpoint, and internal_endpoint
in the common library are working, these are the changes to use
them in the openstack-orchestration recipes.

Partial-Bug: 1412919

Change-Id: Ib89150c12ea833137b5f96c8ac5443c8aac364b4
This commit is contained in:
Ken Thomas 2015-01-29 18:52:50 +00:00
parent 197e54735f
commit aab5d086d8
4 changed files with 199 additions and 17 deletions

View File

@ -18,6 +18,7 @@ This file is used to list changes made in each version of cookbook-openstack-orc
* Add security arguments for heat-keystone-setup-domain command
* Allow domain id as attribute
* Add rabbit_ha_queues=True when rabbit HA is enabled
* Use common specific_endpoint routines (bug 1412919)
## 9.2.0
* python_packages database client attributes have been migrated to

View File

@ -53,14 +53,14 @@ db_user = node['openstack']['db']['orchestration']['username']
db_pass = get_password 'db', 'heat'
sql_connection = db_uri('orchestration', db_user, db_pass)
identity_endpoint = endpoint 'identity-api'
identity_admin_endpoint = endpoint 'identity-admin'
heat_api_bind = endpoint 'orchestration-api-bind'
heat_api_endpoint = endpoint 'orchestration-api'
heat_api_cfn_bind = endpoint 'orchestration-api-cfn-bind'
heat_api_cfn_endpoint = endpoint 'orchestration-api-cfn'
heat_api_cloudwatch_bind = endpoint 'orchestration-api-cloudwatch-bind'
heat_api_cloudwatch_endpoint = endpoint 'orchestration-api-cloudwatch'
identity_endpoint = internal_endpoint 'identity-api'
identity_admin_endpoint = admin_endpoint 'identity-admin'
heat_api_bind = internal_endpoint 'orchestration-api-bind'
heat_api_endpoint = internal_endpoint 'orchestration-api'
heat_api_cfn_bind = internal_endpoint 'orchestration-api-cfn-bind'
heat_api_cfn_endpoint = internal_endpoint 'orchestration-api-cfn'
heat_api_cloudwatch_bind = internal_endpoint 'orchestration-api-cloudwatch-bind'
heat_api_cloudwatch_endpoint = internal_endpoint 'orchestration-api-cloudwatch'
service_pass = get_password 'service', 'openstack-orchestration'

View File

@ -24,13 +24,17 @@ class ::Chef::Recipe # rubocop:disable Documentation
include ::Openstack
end
identity_admin_endpoint = endpoint 'identity-admin'
identity_admin_endpoint = admin_endpoint 'identity-admin'
token = get_secret 'openstack_identity_bootstrap_token'
auth_url = ::URI.decode identity_admin_endpoint.to_s
heat_endpoint = endpoint 'orchestration-api'
heat_cfn_endpoint = endpoint 'orchestration-api-cfn'
admin_heat_endpoint = admin_endpoint 'orchestration-api'
internal_heat_endpoint = internal_endpoint 'orchestration-api'
public_heat_endpoint = public_endpoint 'orchestration-api'
admin_heat_cfn_endpoint = admin_endpoint 'orchestration-api-cfn'
internal_heat_cfn_endpoint = internal_endpoint 'orchestration-api-cfn'
public_heat_cfn_endpoint = public_endpoint 'orchestration-api-cfn'
service_pass = get_password 'service', 'openstack-orchestration'
service_tenant_name = node['openstack']['orchestration']['service_tenant_name']
@ -59,9 +63,9 @@ openstack_identity_register 'Register Heat Orchestration Endpoint' do
bootstrap_token token
service_type 'orchestration'
endpoint_region region
endpoint_adminurl heat_endpoint.to_s
endpoint_internalurl heat_endpoint.to_s
endpoint_publicurl heat_endpoint.to_s
endpoint_adminurl admin_heat_endpoint.to_s
endpoint_internalurl internal_heat_endpoint.to_s
endpoint_publicurl public_heat_endpoint.to_s
action :create_endpoint
end
@ -87,9 +91,9 @@ openstack_identity_register 'Register Heat Cloudformation Endpoint' do
bootstrap_token token
service_type 'cloudformation'
endpoint_region region
endpoint_adminurl heat_cfn_endpoint.to_s
endpoint_internalurl heat_cfn_endpoint.to_s
endpoint_publicurl heat_cfn_endpoint.to_s
endpoint_adminurl admin_heat_cfn_endpoint.to_s
endpoint_internalurl internal_heat_cfn_endpoint.to_s
endpoint_publicurl public_heat_cfn_endpoint.to_s
action :create_endpoint
end

View File

@ -68,6 +68,98 @@ describe 'openstack-orchestration::identity_registration' do
)
end
it 'register heat-api endpoint with different admin url' do
admin_url = 'https://admin.host:123/admin_path'
general_url = 'http://general.host:456/general_path'
# Set the general endpoint
node.set['openstack']['endpoints']['orchestration-api']['uri'] = general_url
# Set the admin endpoint override
node.set['openstack']['endpoints']['admin']['orchestration-api']['uri'] = admin_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Orchestration Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'orchestration',
endpoint_region: 'RegionOne',
endpoint_adminurl: admin_url,
endpoint_internalurl: general_url,
endpoint_publicurl: general_url,
action: [:create_endpoint]
)
end
it 'register heat-api endpoint with different public url' do
public_url = 'https://public.host:789/public_path'
general_url = 'http://general.host:456/general_path'
# Set the general endpoint
node.set['openstack']['endpoints']['orchestration-api']['uri'] = general_url
# Set the public endpoint override
node.set['openstack']['endpoints']['public']['orchestration-api']['uri'] = public_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Orchestration Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'orchestration',
endpoint_region: 'RegionOne',
endpoint_adminurl: general_url,
endpoint_internalurl: general_url,
endpoint_publicurl: public_url,
action: [:create_endpoint]
)
end
it 'register heat-api endpoint with different internal url' do
internal_url = 'http://internal.host:456/internal_path'
general_url = 'http://general.host:456/general_path'
# Set general endpoint
node.set['openstack']['endpoints']['orchestration-api']['uri'] = general_url
# Set the internal endpoint override
node.set['openstack']['endpoints']['internal']['orchestration-api']['uri'] = internal_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Orchestration Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'orchestration',
endpoint_region: 'RegionOne',
endpoint_adminurl: general_url,
endpoint_internalurl: internal_url,
endpoint_publicurl: general_url,
action: [:create_endpoint]
)
end
it 'register heat-api endpoint with all different urls' do
admin_url = 'https://admin.host:123/admin_path'
internal_url = 'http://internal.host:456/internal_path'
public_url = 'https://public.host:789/public_path'
node.set['openstack']['endpoints']['admin']['orchestration-api']['uri'] = admin_url
node.set['openstack']['endpoints']['internal']['orchestration-api']['uri'] = internal_url
node.set['openstack']['endpoints']['public']['orchestration-api']['uri'] = public_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Orchestration Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'orchestration',
endpoint_region: 'RegionOne',
endpoint_adminurl: admin_url,
endpoint_internalurl: internal_url,
endpoint_publicurl: public_url,
action: [:create_endpoint]
)
end
it 'register heat cloudformation endpoint' do
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Cloudformation Endpoint'
@ -83,6 +175,91 @@ describe 'openstack-orchestration::identity_registration' do
)
end
it 'register heat-cfn endpoint with different admin url' do
admin_url = 'https://admin.host:123/admin_path'
general_url = 'http://general.host:456/general_path'
# Set the general endpoint
node.set['openstack']['endpoints']['orchestration-api-cfn']['uri'] = general_url
# Set the admin endpoint override
node.set['openstack']['endpoints']['admin']['orchestration-api-cfn']['uri'] = admin_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Cloudformation Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'cloudformation',
endpoint_region: 'RegionOne',
endpoint_adminurl: admin_url,
endpoint_internalurl: general_url,
endpoint_publicurl: general_url,
action: [:create_endpoint]
)
end
it 'register heat-cfn endpoint with different public url' do
public_url = 'https://public.host:789/public_path'
general_url = 'http://general.host:456/general_path'
# Set the general endpoint
node.set['openstack']['endpoints']['orchestration-api-cfn']['uri'] = general_url
# Set the public endpoint override
node.set['openstack']['endpoints']['public']['orchestration-api-cfn']['uri'] = public_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Cloudformation Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'cloudformation',
endpoint_region: 'RegionOne',
endpoint_adminurl: general_url,
endpoint_internalurl: general_url,
endpoint_publicurl: public_url,
action: [:create_endpoint]
)
end
it 'register heat-cfn endpoint with different internal url' do
internal_url = 'http://internal.host:456/internal_path'
general_url = 'http://general.host:456/general_path'
# Set the general endpoint
node.set['openstack']['endpoints']['orchestration-api-cfn']['uri'] = general_url
# Set the internal endpoint override
node.set['openstack']['endpoints']['internal']['orchestration-api-cfn']['uri'] = internal_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Cloudformation Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'cloudformation',
endpoint_region: 'RegionOne',
endpoint_adminurl: general_url,
endpoint_internalurl: internal_url,
endpoint_publicurl: general_url,
action: [:create_endpoint]
)
end
it 'register heat-cfn endpoint with all different urls' do
admin_url = 'https://admin.host:123/admin_path'
internal_url = 'http://internal.host:456/internal_path'
public_url = 'https://public.host:789/public_path'
node.set['openstack']['endpoints']['admin']['orchestration-api-cfn']['uri'] = admin_url
node.set['openstack']['endpoints']['internal']['orchestration-api-cfn']['uri'] = internal_url
node.set['openstack']['endpoints']['public']['orchestration-api-cfn']['uri'] = public_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Heat Cloudformation Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'cloudformation',
endpoint_region: 'RegionOne',
endpoint_adminurl: admin_url,
endpoint_internalurl: internal_url,
endpoint_publicurl: public_url,
action: [:create_endpoint]
)
end
it 'registers service tenant' do
expect(chef_run).to create_tenant_openstack_identity_register(
'Register Service Tenant'