placement_api: create valid apache config before installing package

If apache is (re)starting while the chef-client installs the
nova-placement-api package, it may pick up the vanilla apache2 conf file
before chef-client gets around to fixing it which may result in apache2
failing due to a non-working configuration.

This changeset eliminates the race by creating a valid configuration
before installing the software. The solution is based on the assumption
that no reasonably configured package manager will overwrite an
existing, user-created configuration file.

backport: queens

Change-Id: Id9f1d165411fc5b3cc73b29a36840cf4dc63d81b
This commit is contained in:
Roger Luethi 2019-07-16 15:50:46 +02:00
parent 5d469d044e
commit ff074af903
1 changed files with 26 additions and 25 deletions

View File

@ -24,31 +24,7 @@ end
include_recipe 'openstack-compute::nova-common'
platform_options = node['openstack']['compute']['platform']
platform_options['api_placement_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
end
nova_user = node['openstack']['compute']['user']
nova_group = node['openstack']['compute']['group']
execute 'placement-api: nova-manage api_db sync' do
timeout node['openstack']['compute']['dbsync_timeout']
user nova_user
group nova_group
command 'nova-manage api_db sync'
action :run
end
service 'disable nova-placement-api service' do
service_name platform_options['api_placement_service']
supports status: true, restart: true
action [:disable, :stop]
end
# Create valid apache site configuration file before installing package
bind_service = node['openstack']['bind_service']['all']['placement-api']
web_app 'nova-placement-api' do
@ -70,3 +46,28 @@ web_app 'nova-placement-api' do
protocol node['openstack']['compute']['placement']['ssl']['protocol']
ciphers node['openstack']['compute']['placement']['ssl']['ciphers']
end
platform_options = node['openstack']['compute']['platform']
platform_options['api_placement_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
end
service 'disable nova-placement-api service' do
service_name platform_options['api_placement_service']
supports status: true, restart: true
action [:disable, :stop]
end
nova_user = node['openstack']['compute']['user']
nova_group = node['openstack']['compute']['group']
execute 'placement-api: nova-manage api_db sync' do
timeout node['openstack']['compute']['dbsync_timeout']
user nova_user
group nova_group
command 'nova-manage api_db sync'
action :run
end