From f662bc35fddad1ba718106dc96c1a0f612b1797b Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Wed, 17 Jul 2019 09:07:51 +0200 Subject: [PATCH] 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 8c0d728d13dffeed1c6a9f51d0422230f2a24671) --- metadata.rb | 2 +- recipes/api.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index c3effbc..8d2c6a7 100644 --- a/metadata.rb +++ b/metadata.rb @@ -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 diff --git a/recipes/api.rb b/recipes/api.rb index 287ae5f..566cbdf 100644 --- a/recipes/api.rb +++ b/recipes/api.rb @@ -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']