Adding guards to keystone_register

The :create_service and :create_endpoint LWRPs do not need to run if
openstack['identity']['catalog']['backend'] is set to 'templated'. Added
warnings in the README, and documented the
openstack['identity']['catalog']['backend'] attribute.

Change-Id: I27ea3a29b3ee540862c5595d186f86d6f62714ff
This commit is contained in:
galstrom21
2014-02-27 21:50:05 -06:00
parent c617cd0abe
commit e49067f707
4 changed files with 69 additions and 25 deletions

View File

@@ -2,6 +2,10 @@
This file is used to list changes made in each version of cookbook-openstack-identity.
## 8.1.1
* Adding guard on register LWRP (:create_service) to not run if backend is 'templated'
* Adding guard on register LWRP (:create_endpoint) to not run if backend is 'templated'
## 8.1.0
* Add client recipe

View File

@@ -99,6 +99,7 @@ Register users, tenants, roles, services and endpoints with Keystone
- service_description: Description of service
- service_type: Type of service to create
- Accepted values are [ "image", "identity", "compute", "storage", "ec2", "volume", "object-store", "metering", "network", "orchestration", "cloudformation" ]
- **NOTE:** call will be skipped if `openstack['identity']['catalog']['backend']` is set to 'templated'
### :create_endpoint Specific Attributes
@@ -109,6 +110,7 @@ Register users, tenants, roles, services and endpoints with Keystone
- Default is same as endpoint_internalURL
- service_type: Type of service to create endpoint for
- Accepted values are [ "image", "identity", "compute", "storage", "ec2", "volume", "object-store", "metering", "network", "orchestration", "cloudformation" ]
- **NOTE:** call will be skipped if `openstack['identity']['catalog']['backend']` is set to 'templated'
### Examples
@@ -251,6 +253,7 @@ Attributes
TODO: Add DB2 support on other platforms
* `openstack['identity']['platform']['db2_python_packages']` - Array of DB2 python packages, only available on redhat platform
* `openstack['identity']['token']['expiration']` - Token validity time in seconds
* `openstack['identity']['catalog']['backend']` - Storage mechanism for the keystone service catalog
Testing
=====

View File

@@ -106,6 +106,7 @@ openstack_identity_register 'Register Identity Service' do
service_description 'Keystone Identity Service'
action :create_service
not_if { node['openstack']['identity']['catalog']['backend'] == 'templated' }
end
node.set['openstack']['identity']['adminURL'] = identity_admin_endpoint.to_s
@@ -126,6 +127,7 @@ openstack_identity_register 'Register Identity Endpoint' do
endpoint_publicurl node['openstack']['identity']['publicURL']
action :create_endpoint
not_if { node['openstack']['identity']['catalog']['backend'] == 'templated' }
end
node['openstack']['identity']['users'].each do |username, user_info|

View File

@@ -158,6 +158,22 @@ describe 'openstack-identity::registration' do
end
describe 'service registration' do
context 'with templated catalog backend' do
before do
node.set['openstack']['identity']['catalog']['backend'] = 'templated'
end
it 'does not register identity service' do
expect(chef_run).to_not create_service_openstack_identity_register(
'Register Identity Service'
)
end
end
context 'with sql catalog backend' do
before do
node.set['openstack']['identity']['catalog']['backend'] = 'sql'
end
it 'registers identity service' do
expect(chef_run).to create_service_openstack_identity_register(
'Register Identity Service'
@@ -168,8 +184,26 @@ describe 'openstack-identity::registration' do
)
end
end
end
describe 'endpoint registration' do
context 'with templated catalog backend' do
before do
node.set['openstack']['identity']['catalog']['backend'] = 'templated'
end
it 'does not register identity endpoint' do
expect(chef_run).to_not create_endpoint_openstack_identity_register(
'Register Identity Endpoint'
)
end
end
context 'with sql catalog backend' do
before do
node.set['openstack']['identity']['catalog']['backend'] = 'sql'
end
it 'registers identity endpoint' do
expect(chef_run).to create_endpoint_openstack_identity_register(
'Register Identity Endpoint'
@@ -193,3 +227,4 @@ describe 'openstack-identity::registration' do
end
end
end
end