Merge "Add support for WEBROOT in local_settings"

This commit is contained in:
Jenkins 2015-06-18 17:39:49 +00:00 committed by Gerrit Code Review
commit ef68ba0a60
4 changed files with 40 additions and 2 deletions

View File

@ -170,7 +170,7 @@ class horizon::wsgi::apache (
error_log_file => 'horizon_error.log', error_log_file => 'horizon_error.log',
priority => $priority, priority => $priority,
aliases => [{ aliases => [{
alias => '/static', alias => "${$::horizon::params::root_url}/static",
path => '/usr/share/openstack-dashboard/static', path => '/usr/share/openstack-dashboard/static',
}], }],
port => 80, port => 80,

View File

@ -327,6 +327,12 @@ describe 'horizon' do
end end
it_behaves_like 'horizon' it_behaves_like 'horizon'
it 'sets WEBROOT in local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
"WEBROOT = '/dashboard/'",
])
end
end end
context 'on Debian platforms' do context 'on Debian platforms' do
@ -344,5 +350,11 @@ describe 'horizon' do
end end
it_behaves_like 'horizon' it_behaves_like 'horizon'
it 'sets WEBROOT in local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
"WEBROOT = '/horizon/'",
])
end
end end
end end

View File

@ -203,6 +203,17 @@ describe 'horizon::wsgi::apache' do
it { it {
is_expected.to contain_class('apache::mod::wsgi').with(:wsgi_socket_prefix => '/var/run/wsgi') is_expected.to contain_class('apache::mod::wsgi').with(:wsgi_socket_prefix => '/var/run/wsgi')
} }
it 'configures webroot alias' do
if (Gem::Version.new(Puppet.version) >= Gem::Version.new('4.0'))
is_expected.to contain_apache__vhost('horizon_vhost').with(
'aliases' => [{'alias' => '/dashboard/static', 'path' => '/usr/share/openstack-dashboard/static'}],
)
else
is_expected.to contain_apache__vhost('horizon_vhost').with(
'aliases' => [['alias', '/dashboard/static'], ['path', '/usr/share/openstack-dashboard/static']],
)
end
end
end end
context 'on Debian platforms' do context 'on Debian platforms' do
@ -226,5 +237,16 @@ describe 'horizon::wsgi::apache' do
end end
it_behaves_like 'apache for horizon' it_behaves_like 'apache for horizon'
it 'configures webroot alias' do
if (Gem::Version.new(Puppet.version) >= Gem::Version.new('4.0'))
is_expected.to contain_apache__vhost('horizon_vhost').with(
'aliases' => [{'alias' => '/horizon/static', 'path' => '/usr/share/openstack-dashboard/static'}],
)
else
is_expected.to contain_apache__vhost('horizon_vhost').with(
'aliases' => [['alias', '/horizon/static'], ['path', '/usr/share/openstack-dashboard/static']],
)
end
end
end end
end end

View File

@ -7,6 +7,10 @@ from openstack_dashboard import exceptions
DEBUG = <%= @django_debug.to_s.capitalize %> DEBUG = <%= @django_debug.to_s.capitalize %>
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG
# WEBROOT is the location relative to Webserver root
# should end with a slash.
WEBROOT = '<%= scope.lookupvar("horizon::params::root_url") %>/'
# Required for Django 1.5. # Required for Django 1.5.
# If horizon is running in production (DEBUG is False), set this # If horizon is running in production (DEBUG is False), set this
# with the list of host/domain names that the application can serve. # with the list of host/domain names that the application can serve.