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-object-storage recipes. Change-Id: Ia6a598bca2f0890ffa853e012dfdac08b51147c4 Partial-Bug: 1412919
This commit is contained in:
parent
4f7405a2a3
commit
93e4487124
|
@ -10,6 +10,7 @@ This file is used to list changes made in each version of cookbook-openstack-obj
|
|||
* Use Common bind endpoint
|
||||
* Add swift.conf template
|
||||
* Cleanup service templates
|
||||
* Use common specific_endpoint routines (bug 1412919)
|
||||
|
||||
## 9.0.3
|
||||
* Bugfix run_command exitstatus
|
||||
|
|
|
@ -27,12 +27,14 @@ 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
|
||||
|
||||
api_endpoint = endpoint 'object-storage-api'
|
||||
admin_api_endpoint = admin_endpoint 'object-storage-api'
|
||||
internal_api_endpoint = internal_endpoint 'object-storage-api'
|
||||
public_api_endpoint = public_endpoint 'object-storage-api'
|
||||
|
||||
service_pass = get_password 'service', 'openstack-object-storage'
|
||||
service_tenant_name = node['openstack']['object-storage']['service_tenant_name']
|
||||
|
@ -57,9 +59,9 @@ openstack_identity_register 'Register Object Storage Endpoint' do
|
|||
bootstrap_token token
|
||||
service_type 'object-store'
|
||||
endpoint_region region
|
||||
endpoint_adminurl api_endpoint.to_s
|
||||
endpoint_internalurl api_endpoint.to_s
|
||||
endpoint_publicurl api_endpoint.to_s
|
||||
endpoint_adminurl admin_api_endpoint.to_s
|
||||
endpoint_internalurl internal_api_endpoint.to_s
|
||||
endpoint_publicurl public_api_endpoint.to_s
|
||||
|
||||
action :create_endpoint
|
||||
end
|
||||
|
|
|
@ -38,6 +38,97 @@ describe 'openstack-object-storage::identity_registration' do
|
|||
)
|
||||
end
|
||||
|
||||
it 'with different admin URL ' do
|
||||
general_url = 'http://general.host:456/general_path'
|
||||
admin_url = 'https://admin.host:123/admin_path'
|
||||
|
||||
# Set general endpoint
|
||||
node.set['openstack']['endpoints']['object-storage-api']['uri'] = general_url
|
||||
# Set the admin endpoint override
|
||||
node.set['openstack']['endpoints']['admin']['object-storage-api']['uri'] = admin_url
|
||||
|
||||
expect(chef_run).to create_endpoint_openstack_identity_register(
|
||||
'Register Object Storage Endpoint'
|
||||
).with(
|
||||
auth_uri: 'http://127.0.0.1:35357/v2.0',
|
||||
bootstrap_token: 'bootstrap-token',
|
||||
service_type: 'object-store',
|
||||
endpoint_region: 'RegionOne',
|
||||
endpoint_adminurl: admin_url,
|
||||
endpoint_internalurl: general_url,
|
||||
endpoint_publicurl: general_url,
|
||||
action: [:create_endpoint]
|
||||
)
|
||||
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']['object-storage-api']['uri'] = general_url
|
||||
# Set the internal endpoint override
|
||||
node.set['openstack']['endpoints']['internal']['object-storage-api']['uri'] = internal_url
|
||||
|
||||
expect(chef_run).to create_endpoint_openstack_identity_register(
|
||||
'Register Object Storage Endpoint'
|
||||
).with(
|
||||
auth_uri: 'http://127.0.0.1:35357/v2.0',
|
||||
bootstrap_token: 'bootstrap-token',
|
||||
service_type: 'object-store',
|
||||
endpoint_region: 'RegionOne',
|
||||
endpoint_adminurl: general_url,
|
||||
endpoint_internalurl: internal_url,
|
||||
endpoint_publicurl: general_url,
|
||||
action: [:create_endpoint]
|
||||
)
|
||||
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']['object-storage-api']['uri'] = general_url
|
||||
# Set the public endpoint override
|
||||
node.set['openstack']['endpoints']['public']['object-storage-api']['uri'] = public_url
|
||||
|
||||
expect(chef_run).to create_endpoint_openstack_identity_register(
|
||||
'Register Object Storage Endpoint'
|
||||
).with(
|
||||
auth_uri: 'http://127.0.0.1:35357/v2.0',
|
||||
bootstrap_token: 'bootstrap-token',
|
||||
service_type: 'object-store',
|
||||
endpoint_region: 'RegionOne',
|
||||
endpoint_adminurl: general_url,
|
||||
endpoint_internalurl: general_url,
|
||||
endpoint_publicurl: public_url,
|
||||
action: [:create_endpoint]
|
||||
)
|
||||
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']['object-storage-api']['uri'] = admin_url
|
||||
node.set['openstack']['endpoints']['internal']['object-storage-api']['uri'] = internal_url
|
||||
node.set['openstack']['endpoints']['public']['object-storage-api']['uri'] = public_url
|
||||
expect(chef_run).to create_endpoint_openstack_identity_register(
|
||||
'Register Object Storage Endpoint'
|
||||
).with(
|
||||
auth_uri: 'http://127.0.0.1:35357/v2.0',
|
||||
bootstrap_token: 'bootstrap-token',
|
||||
service_type: 'object-store',
|
||||
endpoint_region: 'RegionOne',
|
||||
endpoint_adminurl: admin_url,
|
||||
endpoint_internalurl: internal_url,
|
||||
endpoint_publicurl: public_url,
|
||||
action: [:create_endpoint]
|
||||
)
|
||||
end
|
||||
|
||||
it 'with custom region override' do
|
||||
node.set['openstack']['object-storage']['region'] = 'swiftRegion'
|
||||
expect(chef_run).to create_endpoint_openstack_identity_register(
|
||||
|
|
Loading…
Reference in New Issue