From 7886c81a749c4aee3deaa6f751880e0eb05db1ad Mon Sep 17 00:00:00 2001 From: Mark Vanderwiel Date: Fri, 16 Jan 2015 12:46:52 -0600 Subject: [PATCH] Fix site directory defaults for apache 2.4 With the 2.4 release the site config for directies was changed as noted in the bug link. If necessary, in the future we could create a list attribute to hold the directory options to allow them to be overrideable, but no one has asked for that yet. This could also use the apache cookbook web_app provider to create this site config. Also cleaned up some minor formatting in the specs. Change-Id: Ie2b323ac055ae03b3c4ebb28b70aca65745df842 Closes-Bug: #1411772 --- CHANGELOG.md | 1 + spec/apache2-server_spec.rb | 11 +++++++++++ spec/horizon-redhat_spec.rb | 1 - spec/horizon-suse_spec.rb | 12 ++++++------ templates/default/dash-site.erb | 16 ++++++++++++---- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f480ad7..336abdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This file is used to list changes made in each version of the openstack-dashboar * Allow TraceEnable to be configured * Allow volume_api_version to be configured for Horizon * Allow webserver to be configurable +* Fix site template directory defaults for apache 2.4 ## 9.1 * python_packages database client attributes have been moved to the -common cookbook diff --git a/spec/apache2-server_spec.rb b/spec/apache2-server_spec.rb index d263eda..7bae929 100644 --- a/spec/apache2-server_spec.rb +++ b/spec/apache2-server_spec.rb @@ -284,6 +284,17 @@ describe 'openstack-dashboard::apache2-server' do end end + context 'directory options' do + it 'sets default options for apache 2.2' do + expect(chef_run).to render_file(file.name).with_content(/^\s*Order allow,deny\n\s*allow from all$/) + end + + it 'sets default options for apache 2.4' do + node.set['apache']['version'] = '2.4' + expect(chef_run).to render_file(file.name).with_content(/^\s*Require all granted$/) + end + end + context 'log directives' do before do node.set['apache']['log_dir'] = 'log_dir_value' diff --git a/spec/horizon-redhat_spec.rb b/spec/horizon-redhat_spec.rb index 1e13807..a2e6c34 100644 --- a/spec/horizon-redhat_spec.rb +++ b/spec/horizon-redhat_spec.rb @@ -50,7 +50,6 @@ describe 'openstack-dashboard::horizon' do end it 'does not remove openstack-dashboard-ubuntu-theme package' do - expect(chef_run).not_to purge_package('openstack-dashboard-ubuntu-theme') end end diff --git a/spec/horizon-suse_spec.rb b/spec/horizon-suse_spec.rb index 2b6ae8b..ef0a492 100644 --- a/spec/horizon-suse_spec.rb +++ b/spec/horizon-suse_spec.rb @@ -57,13 +57,13 @@ describe 'openstack-dashboard::horizon' do it 'does not execute openstack-dashboard syncdb by default' do cmd = 'python manage.py syncdb --noinput' expect(chef_run).not_to run_execute(cmd).with( - cwd: '/srv/www/openstack-dashboard', - environment: { - 'PYTHONPATH' => '/etc/openstack-dashboard:' \ - '/srv/www/openstack-dashboard:' \ - '$PYTHONPATH' + cwd: '/srv/www/openstack-dashboard', + environment: { + 'PYTHONPATH' => '/etc/openstack-dashboard:' \ + '/srv/www/openstack-dashboard:' \ + '$PYTHONPATH' } - ) + ) end end end diff --git a/templates/default/dash-site.erb b/templates/default/dash-site.erb index 334a93e..fb0ae82 100644 --- a/templates/default/dash-site.erb +++ b/templates/default/dash-site.erb @@ -44,15 +44,23 @@ NameVirtualHost *:<%= node['openstack']['dashboard']['https_port'].to_i%> > Options Indexes FollowSymLinks MultiViews AllowOverride None + <% if node['apache']['version'] == '2.4' -%> + Require all granted + <% else -%> Order allow,deny allow from all + <% end -%> > - Options FollowSymLinks MultiViews - AllowOverride None - Order allow,deny - allow from all + Options FollowSymLinks MultiViews + AllowOverride None + <% if node['apache']['version'] == '2.4' -%> + Require all granted + <% else -%> + Order allow,deny + allow from all + <% end -%> <% if node["openstack"]["dashboard"]["use_ssl"] %>