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',
}
# 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 == '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'],
}
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 {
Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_cache']
}
if $::os_package_type == 'rpm' and $compress_offline {
Concat[$::horizon::params::config_file] ~> Exec['refresh_horizon_django_cache']
}
if $configure_apache {

View File

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

View File

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