Do not run collectstatic or compress in Debian
The Debian packages are handling compress & collectstatic in a different way as for Ubuntu. This patch avoids running them, and offload that works to the package. The original collectstatic indicated that it was a workaround for Debian. See I813b5f6067bb6ecce279cab7278d9227c4d31d28. Because of this, the logic around the collectstatic exec has been limited to only RedHat packaging. Note that the variable os_package_type can be defined if we're using Debian packages on top of Ubuntu (this is achieved by installing the puppet-openstack-debian-fact package on Ubuntu). This has been discussed in Tokyo with Emilien. Also, this package fixes the configuration file path for Apache. Change-Id: I3fbb1b576dd61ddd92921e9f12edfe5df21fddd0 Co-Authored-By: Alex Schultz <aschultz@mirantis.com>
This commit is contained in:
parent
76d86aadeb
commit
0eada93284
@ -373,14 +373,21 @@ class horizon(
|
||||
ensure => $package_ensure,
|
||||
}
|
||||
|
||||
exec { 'refresh_horizon_django_cache':
|
||||
command => "${::horizon::params::manage_py} collectstatic --noinput --clear && ${::horizon::params::manage_py} compress --force",
|
||||
refreshonly => true,
|
||||
require => [Package['python-lesscpy'], Package['horizon']],
|
||||
}
|
||||
# debian/ubuntu do not use collect static as the packaging already handles
|
||||
# this as part of the packages. This was put in as a work around for Debian
|
||||
# who has since fixed their packaging.
|
||||
# See I813b5f6067bb6ecce279cab7278d9227c4d31d28 for the original history
|
||||
# behind this section.
|
||||
if $::os_package_type == 'redhat' {
|
||||
exec { 'refresh_horizon_django_cache':
|
||||
command => "${::horizon::params::manage_py} collectstatic --noinput --clear && ${::horizon::params::manage_py} compress --force",
|
||||
refreshonly => true,
|
||||
require => [Package['python-lesscpy'], Package['horizon']],
|
||||
}
|
||||
|
||||
if $compress_offline {
|
||||
Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_cache']
|
||||
if $compress_offline {
|
||||
Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_cache']
|
||||
}
|
||||
}
|
||||
|
||||
if $configure_apache {
|
||||
|
@ -29,10 +29,10 @@ class horizon::params {
|
||||
$apache_group = 'www-data'
|
||||
$wsgi_user = 'horizon'
|
||||
$wsgi_group = 'horizon'
|
||||
case $::operatingsystem {
|
||||
'Debian': {
|
||||
case $::os_package_type {
|
||||
'debian': {
|
||||
$package_name = 'openstack-dashboard-apache'
|
||||
$httpd_config_file = '/etc/apache2/sites-available/openstack-dashboard.conf'
|
||||
$httpd_config_file = '/etc/apache2/sites-available/openstack-dashboard-alias-only.conf'
|
||||
}
|
||||
default: {
|
||||
$package_name = 'openstack-dashboard'
|
||||
|
@ -31,11 +31,23 @@ describe 'horizon' do
|
||||
:tag => ['openstack', 'horizon-package'],
|
||||
)
|
||||
}
|
||||
it { is_expected.to contain_exec('refresh_horizon_django_cache').with({
|
||||
it {
|
||||
if facts[:os_package_type] == 'redhat'
|
||||
is_expected.to contain_exec('refresh_horizon_django_cache').with({
|
||||
:command => '/usr/share/openstack-dashboard/manage.py collectstatic --noinput --clear && /usr/share/openstack-dashboard/manage.py compress --force',
|
||||
:refreshonly => true,
|
||||
})}
|
||||
it { is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]') }
|
||||
})
|
||||
else
|
||||
is_expected.to_not contain_exec('refresh_horizon_django_cache')
|
||||
end
|
||||
}
|
||||
it {
|
||||
if facts[:os_package_type] == 'redhat'
|
||||
is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]')
|
||||
else
|
||||
is_expected.to_not contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]')
|
||||
end
|
||||
}
|
||||
|
||||
it 'configures apache' do
|
||||
is_expected.to contain_class('horizon::wsgi::apache').with({
|
||||
@ -167,7 +179,13 @@ describe 'horizon' do
|
||||
])
|
||||
end
|
||||
|
||||
it { is_expected.to contain_exec('refresh_horizon_django_cache') }
|
||||
it {
|
||||
if facts[:os_package_type] == 'redhat'
|
||||
is_expected.to contain_exec('refresh_horizon_django_cache')
|
||||
else
|
||||
is_expected.to_not contain_exec('refresh_horizon_django_cache')
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
context 'with tuskar-ui enabled' do
|
||||
@ -361,7 +379,9 @@ describe 'horizon' do
|
||||
before do
|
||||
facts.merge!({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystemrelease => '6.0'
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:os_package_type => 'debian'
|
||||
})
|
||||
end
|
||||
|
||||
@ -379,4 +399,30 @@ describe 'horizon' do
|
||||
])
|
||||
end
|
||||
end
|
||||
|
||||
context 'on Ubuntu platforms' do
|
||||
before do
|
||||
facts.merge!({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:operatingsystemrelease => '14.04',
|
||||
:os_package_type => 'ubuntu'
|
||||
})
|
||||
end
|
||||
|
||||
let :platforms_params do
|
||||
{ :config_file => '/etc/openstack-dashboard/local_settings.py',
|
||||
:package_name => 'openstack-dashboard',
|
||||
:root_url => '/horizon' }
|
||||
end
|
||||
|
||||
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
|
||||
|
@ -221,7 +221,45 @@ describe 'horizon::wsgi::apache' do
|
||||
before do
|
||||
facts.merge!({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystemrelease => '6.0'
|
||||
:operatingsystem => 'Debian',
|
||||
:operatingsystemrelease => '6.0',
|
||||
:os_package_type => 'debian'
|
||||
})
|
||||
end
|
||||
|
||||
let :platforms_params do
|
||||
{ :http_service => 'apache2',
|
||||
:httpd_config_file => '/etc/apache2/sites-available/openstack-dashboard-alias-only.conf',
|
||||
:root_url => '/horizon',
|
||||
:apache_user => 'www-data',
|
||||
:apache_group => 'www-data',
|
||||
:wsgi_user => 'horizon',
|
||||
:wsgi_group => 'horizon',
|
||||
:unix_user => 'horizon',
|
||||
:unix_group => 'horizon' }
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
context 'on Ubuntu platforms' do
|
||||
before do
|
||||
facts.merge!({
|
||||
:osfamily => 'Debian',
|
||||
:operatingsystem => 'Ubuntu',
|
||||
:operatingsystemrelease => '14.04',
|
||||
:os_package_type => 'ubuntu'
|
||||
})
|
||||
end
|
||||
|
||||
@ -250,4 +288,5 @@ describe 'horizon::wsgi::apache' do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user