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-telemetry recipes.

Change-Id: Ibddb87c1ae2e92c43c0b88495d363b6d8179d300
Partial-Bug: 1412919
This commit is contained in:
Ken Thomas 2015-01-30 22:20:27 +00:00
parent 04a01ac6ac
commit dcaeffd75c
4 changed files with 95 additions and 8 deletions

View File

@ -13,6 +13,7 @@ h_algorithms to be configurable
* Bump Chef gem to 11.16
* Allow rabbit_hosts and rabbit_ha_queues to be configurable
* Allow dbsync_timeout to be configurable
* Use common specific_endpoint routines (bug 1412919)
## 10.0.0
* Upgrading to Juno

View File

@ -61,9 +61,9 @@ service_user = node['openstack']['telemetry']['service_user']
service_pass = get_password 'service', 'openstack-ceilometer'
service_tenant = node['openstack']['telemetry']['service_tenant_name']
identity_endpoint = endpoint 'identity-api'
identity_admin_endpoint = endpoint 'identity-admin'
image_endpoint = endpoint 'image-api'
identity_endpoint = internal_endpoint 'identity-api'
identity_admin_endpoint = admin_endpoint 'identity-admin'
image_endpoint = internal_endpoint 'image-api'
telemetry_api_bind = endpoint 'telemetry-api-bind'
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['telemetry']['api']['auth']['version']

View File

@ -24,8 +24,10 @@ class ::Chef::Recipe # rubocop:disable Documentation
include ::Openstack
end
api_endpoint = endpoint 'telemetry-api'
identity_admin_endpoint = endpoint 'identity-admin'
admin_api_endpoint = admin_endpoint 'telemetry-api'
internal_api_endpoint = internal_endpoint 'telemetry-api'
public_api_endpoint = public_endpoint 'telemetry-api'
identity_admin_endpoint = admin_endpoint 'identity-admin'
bootstrap_token = get_secret 'openstack_identity_bootstrap_token'
auth_uri = ::URI.decode identity_admin_endpoint.to_s
service_pass = get_password 'service', 'openstack-ceilometer'
@ -80,9 +82,9 @@ openstack_identity_register 'Register Metering Endpoint' do
bootstrap_token bootstrap_token
service_type 'metering'
endpoint_region node['openstack']['telemetry']['region']
endpoint_adminurl ::URI.decode api_endpoint.to_s
endpoint_internalurl ::URI.decode api_endpoint.to_s
endpoint_publicurl ::URI.decode api_endpoint.to_s
endpoint_adminurl ::URI.decode admin_api_endpoint.to_s
endpoint_internalurl ::URI.decode internal_api_endpoint.to_s
endpoint_publicurl ::URI.decode public_api_endpoint.to_s
action :create_endpoint
end

View File

@ -71,6 +71,90 @@ describe 'openstack-telemetry::identity_registration' do
)
end
it 'with different admin URL' do
admin_url = 'https://admin.host:123/admin_path'
general_url = 'http://general.host:456/general_path'
# Set general endpoint
node.set['openstack']['endpoints']['telemetry-api']['uri'] = general_url
# Set the admin endpoint override
node.set['openstack']['endpoints']['admin']['telemetry-api']['uri'] = admin_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Metering Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'metering',
endpoint_region: 'RegionOne',
endpoint_adminurl: admin_url,
endpoint_internalurl: general_url,
endpoint_publicurl: general_url
)
end
it 'with different public URL' do
general_url = 'http://general.host:456/general_path'
public_url = 'https://public.host:789/public_path'
# Set general endpoint
node.set['openstack']['endpoints']['telemetry-api']['uri'] = general_url
# Set the public endpoint override
node.set['openstack']['endpoints']['public']['telemetry-api']['uri'] = public_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Metering Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'metering',
endpoint_region: 'RegionOne',
endpoint_adminurl: general_url,
endpoint_internalurl: general_url,
endpoint_publicurl: public_url
)
end
it 'with different internal URL' do
general_url = 'http://general.host:456/general_path'
internal_url = 'http://internal.host:456/internal_path'
# Set general endpoint
node.set['openstack']['endpoints']['telemetry-api']['uri'] = general_url
# Set the internal endpoint override
node.set['openstack']['endpoints']['internal']['telemetry-api']['uri'] = internal_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Metering Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'metering',
endpoint_region: 'RegionOne',
endpoint_adminurl: general_url,
endpoint_internalurl: internal_url,
endpoint_publicurl: general_url
)
end
it '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']['telemetry-api']['uri'] = admin_url
node.set['openstack']['endpoints']['internal']['telemetry-api']['uri'] = internal_url
node.set['openstack']['endpoints']['public']['telemetry-api']['uri'] = public_url
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Metering Endpoint'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
service_type: 'metering',
endpoint_region: 'RegionOne',
endpoint_adminurl: admin_url,
endpoint_internalurl: internal_url,
endpoint_publicurl: public_url
)
end
it 'with custom region override' do
node.set['openstack']['telemetry']['region'] = 'meteringRegion'