Merge "Properly notify apache restarts on cinder configuration updates"
This commit is contained in:
commit
11ee82bb4d
|
@ -92,3 +92,19 @@ web_app 'cinder-api' do
|
||||||
protocol node['openstack']['block-storage']['ssl']['protocol']
|
protocol node['openstack']['block-storage']['ssl']['protocol']
|
||||||
ciphers node['openstack']['block-storage']['ssl']['ciphers']
|
ciphers node['openstack']['block-storage']['ssl']['ciphers']
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Hack until Apache cookbook has lwrp's for proper use of notify restart
|
||||||
|
# apache2 after keystone if completely configured. Whenever a cinder
|
||||||
|
# config is updated, have it notify the resource which clears the lock
|
||||||
|
# so the service can be restarted.
|
||||||
|
# TODO(ramereth): This should be removed once this cookbook is updated
|
||||||
|
# to use the newer apache2 cookbook which uses proper resources.
|
||||||
|
edit_resource(:template, "#{node['apache']['dir']}/sites-available/cinder-api.conf") do
|
||||||
|
notifies :run, 'execute[Clear cinder-api apache restart]', :immediately
|
||||||
|
end
|
||||||
|
|
||||||
|
execute 'cinder-api apache restart' do
|
||||||
|
command "touch #{Chef::Config[:file_cache_path]}/cinder-api-apache-restarted"
|
||||||
|
creates "#{Chef::Config[:file_cache_path]}/cinder-api-apache-restarted"
|
||||||
|
notifies :restart, 'service[apache2]', :immediately
|
||||||
|
end
|
||||||
|
|
|
@ -83,13 +83,8 @@ end
|
||||||
# merge all config options and secrets to be used in the cinder.conf.erb
|
# merge all config options and secrets to be used in the cinder.conf.erb
|
||||||
cinder_conf_options = merge_config_options 'block-storage'
|
cinder_conf_options = merge_config_options 'block-storage'
|
||||||
|
|
||||||
service 'cinder-apache2' do
|
execute 'Clear cinder-api apache restart' do
|
||||||
case node['platform_family']
|
command "rm -f #{Chef::Config[:file_cache_path]}/cinder-api-apache-restarted"
|
||||||
when 'debian'
|
|
||||||
service_name 'apache2'
|
|
||||||
when 'rhel'
|
|
||||||
service_name 'httpd'
|
|
||||||
end
|
|
||||||
action :nothing
|
action :nothing
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -102,7 +97,7 @@ template '/etc/cinder/cinder.conf' do
|
||||||
variables(
|
variables(
|
||||||
service_config: cinder_conf_options
|
service_config: cinder_conf_options
|
||||||
)
|
)
|
||||||
notifies :restart, 'service[cinder-apache2]'
|
notifies :run, 'execute[Clear cinder-api apache restart]', :immediately
|
||||||
end
|
end
|
||||||
|
|
||||||
# delete all secrets saved in the attribute
|
# delete all secrets saved in the attribute
|
||||||
|
|
|
@ -12,7 +12,35 @@ describe 'openstack-block-storage::api' do
|
||||||
|
|
||||||
include_context 'block-storage-stubs'
|
include_context 'block-storage-stubs'
|
||||||
include_examples 'common-logging'
|
include_examples 'common-logging'
|
||||||
include_examples 'creates_cinder_conf', 'service[cinder-apache2]', 'cinder', 'cinder'
|
include_examples 'creates_cinder_conf', 'execute[Clear cinder-api apache restart]', 'cinder', 'cinder', 'run'
|
||||||
|
|
||||||
|
it do
|
||||||
|
expect(chef_run).to nothing_execute('Clear cinder-api apache restart')
|
||||||
|
.with(
|
||||||
|
command: 'rm -f /var/chef/cache/cinder-api-apache-restarted'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
%w(
|
||||||
|
/etc/cinder/cinder.conf
|
||||||
|
/etc/apache2/sites-available/cinder-api.conf
|
||||||
|
).each do |f|
|
||||||
|
it "#{f} notifies execute[Clear cinder-api apache restart]" do
|
||||||
|
expect(chef_run.template(f)).to notify('execute[Clear cinder-api apache restart]').to(:run).immediately
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
expect(chef_run).to run_execute('cinder-api apache restart')
|
||||||
|
.with(
|
||||||
|
command: 'touch /var/chef/cache/cinder-api-apache-restarted',
|
||||||
|
creates: '/var/chef/cache/cinder-api-apache-restarted'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it do
|
||||||
|
expect(chef_run.execute('cinder-api apache restart')).to notify('service[apache2]').to(:restart).immediately
|
||||||
|
end
|
||||||
|
|
||||||
it 'upgrades cinder api packages' do
|
it 'upgrades cinder api packages' do
|
||||||
expect(chef_run).to upgrade_package('cinder-api')
|
expect(chef_run).to upgrade_package('cinder-api')
|
||||||
|
|
|
@ -13,6 +13,7 @@ RSpec.configure do |config|
|
||||||
config.color = true
|
config.color = true
|
||||||
config.formatter = :documentation
|
config.formatter = :documentation
|
||||||
config.log_level = :fatal
|
config.log_level = :fatal
|
||||||
|
config.file_cache_path = '/var/chef/cache'
|
||||||
end
|
end
|
||||||
|
|
||||||
REDHAT_OPTS = {
|
REDHAT_OPTS = {
|
||||||
|
|
Loading…
Reference in New Issue