Leave an ability to trigger collectstatic for debian/ubuntu

We need to have an ability to re-run collectstatic and compress
in case of changing horizon theme using `custom_theme_path`
parameter. So, we need to have 'exec collecstatic' resource
defined with 'refreshonly' parameter set to 'true.

The default behavior is still the same: collecstatic
isn't triggerred for debian packages.

Change-Id: I9096feca0935bfbeb1cc492c5aacb10d2ffa2b6d
This commit is contained in:
iberezovskiy 2016-02-15 14:44:26 +03:00
parent 5cbb6a5795
commit 1c51079068
3 changed files with 13 additions and 33 deletions

View File

@ -390,21 +390,14 @@ class horizon(
order => '50', order => '50',
} }
# debian/ubuntu do not use collect static as the packaging already handles exec { 'refresh_horizon_django_cache':
# this as part of the packages. This was put in as a work around for Debian command => "${::horizon::params::manage_py} collectstatic --noinput --clear && ${::horizon::params::manage_py} compress --force",
# who has since fixed their packaging. refreshonly => true,
# See I813b5f6067bb6ecce279cab7278d9227c4d31d28 for the original history require => Package['horizon'],
# behind this section. }
if $::os_package_type == 'rpm' {
exec { 'refresh_horizon_django_cache':
command => "${::horizon::params::manage_py} collectstatic --noinput --clear && ${::horizon::params::manage_py} compress --force",
refreshonly => true,
require => Package['horizon'],
}
if $compress_offline { if $::os_package_type == 'rpm' and $compress_offline {
Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_cache'] Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_cache']
}
} }
if $configure_apache { if $configure_apache {

View File

@ -30,16 +30,10 @@ describe 'horizon' do
:tag => ['openstack', 'horizon-package'], :tag => ['openstack', 'horizon-package'],
) )
} }
it { it { is_expected.to contain_exec('refresh_horizon_django_cache').with({
if facts[:os_package_type] == 'rpm'
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', :command => '/usr/share/openstack-dashboard/manage.py collectstatic --noinput --clear && /usr/share/openstack-dashboard/manage.py compress --force',
:refreshonly => true, :refreshonly => true,
}) })}
else
is_expected.to_not contain_exec('refresh_horizon_django_cache')
end
}
it { it {
if facts[:os_package_type] == 'rpm' if facts[:os_package_type] == 'rpm'
is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]') is_expected.to contain_concat(platforms_params[:config_file]).that_notifies('Exec[refresh_horizon_django_cache]')
@ -187,13 +181,7 @@ describe 'horizon' do
]) ])
end end
it { it { is_expected.to contain_exec('refresh_horizon_django_cache') }
if facts[:os_package_type] == 'rpm'
is_expected.to contain_exec('refresh_horizon_django_cache')
else
is_expected.to_not contain_exec('refresh_horizon_django_cache')
end
}
end end
context 'with tuskar-ui enabled' do context 'with tuskar-ui enabled' do
@ -414,7 +402,8 @@ describe 'horizon' do
before do before do
facts.merge!({ facts.merge!({
:osfamily => 'RedHat', :osfamily => 'RedHat',
:operatingsystemrelease => '6.0' :operatingsystemrelease => '6.0',
:os_package_type => 'rpm'
}) })
end end
@ -437,8 +426,8 @@ describe 'horizon' do
before do before do
facts.merge!({ facts.merge!({
:osfamily => 'Debian', :osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => '6.0', :operatingsystemrelease => '6.0',
:operatingsystem => 'Debian',
:os_package_type => 'debian' :os_package_type => 'debian'
}) })
end end
@ -482,5 +471,4 @@ describe 'horizon' do
]) ])
end end
end end
end end

View File

@ -292,5 +292,4 @@ describe 'horizon::wsgi::apache' do
end end
end end
end end
end end