Allow policy.json file to be specified
The policy.json file was removed in e5beee63c1
this will allow you to specify an attribute to point to a location of a
policy.json file to be used.
By default this is nil and the packaged policy.json file will be used,
but if required this can be overridden.
Change-Id: Ic3a1b0c507be627acbee1c74302997fa66a72e4b
Implements: blueprint remote-policy
This commit is contained in:
parent
5f8300c216
commit
97955ecb78
|
@ -37,6 +37,9 @@ default['openstack']['block-storage']['custom_template_banner'] = '
|
|||
default['openstack']['block-storage']['verbose'] = 'False'
|
||||
default['openstack']['block-storage']['debug'] = 'False'
|
||||
|
||||
# Specify policy.json remote file to import
|
||||
default['openstack']['block-storage']['policyfile_url'] = nil
|
||||
|
||||
# Default lock_path
|
||||
default['openstack']['block-storage']['lock_path'] = '/var/lock/cinder'
|
||||
# Default notification_driver and control exchange
|
||||
|
|
|
@ -77,3 +77,13 @@ template '/etc/cinder/api-paste.ini' do
|
|||
|
||||
notifies :restart, 'service[cinder-api]', :immediately
|
||||
end
|
||||
|
||||
if node['openstack']['block-storage']['policyfile_url']
|
||||
remote_file '/etc/cinder/policy.json' do
|
||||
source node['openstack']['block-storage']['policyfile_url']
|
||||
owner node['openstack']['block-storage']['user']
|
||||
group node['openstack']['block-storage']['group']
|
||||
mode 00644
|
||||
notifies :restart, 'service[cinder-api]'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -141,5 +141,22 @@ describe 'openstack-block-storage::api' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'policy file' do
|
||||
it 'does not manage policy file unless specified' do
|
||||
expect(chef_run).not_to create_remote_file('/etc/cinder/policy.json')
|
||||
end
|
||||
describe 'policy file specified' do
|
||||
before { node.set['openstack']['block-storage']['policyfile_url'] = 'http://server/mypolicy.json' }
|
||||
let(:remote_policy) { chef_run.remote_file('/etc/cinder/policy.json') }
|
||||
|
||||
it 'manages policy file when remote file is specified' do
|
||||
expect(chef_run).to create_remote_file('/etc/cinder/policy.json').with(
|
||||
user: 'cinder',
|
||||
group: 'cinder',
|
||||
mode: 00644)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue