From ff074af903390c07e07514df7ffc00a6bfc1475e Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Tue, 16 Jul 2019 15:50:46 +0200 Subject: [PATCH] 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 --- recipes/placement_api.rb | 51 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/recipes/placement_api.rb b/recipes/placement_api.rb index 8ab4f877..7ef547d6 100644 --- a/recipes/placement_api.rb +++ b/recipes/placement_api.rb @@ -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