api: prevent installation of invalid apache2 conf file

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

This changeset eliminates the race by creating an empty configuration
file 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. The empty configuration
file is left in place to avoid its creation and removal during every
recipe run.

backport: queens

Change-Id: I225a30379820e6e033bcea987fbf1a4db33dbd3a
(cherry picked from commit 8c0d728d13)
This commit is contained in:
Roger Luethi 2019-07-17 09:07:51 +02:00
parent 9188783b25
commit f662bc35fd
2 changed files with 11 additions and 1 deletions

View File

@ -4,7 +4,7 @@ maintainer_email 'openstack-dev@lists.openstack.org'
license 'Apache-2.0'
description 'The OpenStack Advanced Volume Management service Cinder.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '17.1.1'
version '17.2.0'
%w(ubuntu redhat centos).each do |os|
supports os

View File

@ -30,6 +30,16 @@ include_recipe 'openstack-block-storage::cinder-common'
bind_service = node['openstack']['bind_service']['all']['block-storage']
platform_options = node['openstack']['block-storage']['platform']
# create file to prevent installation of non-working configuration
file '/etc/apache2/conf-available/cinder-wsgi.conf' do
owner 'root'
group 'www-data'
mode '0640'
action :create
content '# Chef openstack-block-storage: file to block config from package'
only_if { platform_family? 'debian' }
end
platform_options['cinder_api_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']