Merge "Make sure python3-redis is installed"

This commit is contained in:
Zuul 2024-04-25 15:36:33 +00:00 committed by Gerrit Code Review
commit 1dcc7f7df5
3 changed files with 69 additions and 30 deletions

View File

@ -700,6 +700,14 @@ Use PyMemcacheCache backend instead")
Anchor['horizon::install::begin']
-> Package<| name == $::horizon::params::pymemcache_package |>
-> Anchor['horizon::install::end']
} elsif $cache_backend =~ /\.RedisCache$/ {
ensure_packages('python-redis', {
name => $::horizon::params::python_redis_package,
tag => ['openstack'],
})
Anchor['horizon::install::begin']
-> Package<| name == $::horizon::params::python_redis_package |>
-> Anchor['horizon::install::end']
}
}

View File

@ -23,6 +23,7 @@ class horizon::params {
$wsgi_group = 'apache'
$memcache_package = 'python3-memcached'
$pymemcache_package = 'python3-pymemcache'
$python_redis_package = 'python3-redis'
$designate_dashboard_package_name = 'openstack-designate-ui'
$heat_dashboard_package_name = 'openstack-heat-ui'
$ironic_dashboard_package_name = 'openstack-ironic-ui'
@ -41,6 +42,7 @@ class horizon::params {
$wsgi_group = 'horizon'
$memcache_package = 'python3-memcache'
$pymemcache_package = 'python3-pymemcache'
$python_redis_package = 'python3-redis'
$designate_dashboard_package_name = 'python3-designate-dashboard'
$heat_dashboard_package_name = 'python3-heat-dashboard'
$ironic_dashboard_package_name = 'python3-ironic-ui'

View File

@ -364,6 +364,32 @@ describe 'horizon' do
it { is_expected.not_to contain_package('python-pymemcache') }
end
context 'installs python redis library when cache_backend is set to redis' do
before do
params.merge!({
:cache_backend => 'django.core.cache.backends.redis.RedisCache',
})
end
it {
is_expected.to contain_package('python-redis').with(
:tag => ['openstack'],
:name => platforms_params[:python_redis_package],
)
}
end
context 'does not install python redis when manage_memcache_package set to false' do
before do
params.merge!({
:cache_backend => 'django.core.cache.backends.redis.RedisCache',
:manage_memcache_package => false
})
end
it { is_expected.not_to contain_package('python-redis') }
end
context 'with custom wsgi options' do
before do
params.merge!( :wsgi_processes => '30',
@ -795,41 +821,44 @@ describe 'horizon' do
case facts[:os]['family']
when 'Debian'
if facts[:os]['name'] == 'Debian'
{ :config_file => '/etc/openstack-dashboard/local_settings.py',
:conf_d_dir => '/etc/openstack-dashboard/local_settings.d',
:secret_key_file => '/etc/openstack-dashboard/.secret_key_store',
:package_name => 'openstack-dashboard-apache',
:root_url => '/horizon',
:root_path => '/var/lib/openstack-dashboard',
:memcache_package => 'python3-memcache',
:pymemcache_package => 'python3-pymemcache',
:wsgi_user => 'horizon',
:wsgi_group => 'horizon',
{ :config_file => '/etc/openstack-dashboard/local_settings.py',
:conf_d_dir => '/etc/openstack-dashboard/local_settings.d',
:secret_key_file => '/etc/openstack-dashboard/.secret_key_store',
:package_name => 'openstack-dashboard-apache',
:root_url => '/horizon',
:root_path => '/var/lib/openstack-dashboard',
:memcache_package => 'python3-memcache',
:pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'horizon',
:wsgi_group => 'horizon',
}
else
{ :config_file => '/etc/openstack-dashboard/local_settings.py',
:conf_d_dir => '/etc/openstack-dashboard/local_settings.d',
:secret_key_file => '/etc/openstack-dashboard/.secret_key_store',
:package_name => 'openstack-dashboard',
:root_url => '/horizon',
:root_path => '/var/lib/openstack-dashboard',
:memcache_package => 'python3-memcache',
:pymemcache_package => 'python3-pymemcache',
:wsgi_user => 'horizon',
:wsgi_group => 'horizon',
{ :config_file => '/etc/openstack-dashboard/local_settings.py',
:conf_d_dir => '/etc/openstack-dashboard/local_settings.d',
:secret_key_file => '/etc/openstack-dashboard/.secret_key_store',
:package_name => 'openstack-dashboard',
:root_url => '/horizon',
:root_path => '/var/lib/openstack-dashboard',
:memcache_package => 'python3-memcache',
:pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'horizon',
:wsgi_group => 'horizon',
}
end
when 'RedHat'
{ :config_file => '/etc/openstack-dashboard/local_settings',
:conf_d_dir => '/etc/openstack-dashboard/local_settings.d',
:secret_key_file => '/etc/openstack-dashboard/.secret_key_store',
:package_name => 'openstack-dashboard',
:root_url => '/dashboard',
:root_path => '/usr/share/openstack-dashboard',
:memcache_package => 'python3-memcached',
:pymemcache_package => 'python3-pymemcache',
:wsgi_user => 'apache',
:wsgi_group => 'apache',
{ :config_file => '/etc/openstack-dashboard/local_settings',
:conf_d_dir => '/etc/openstack-dashboard/local_settings.d',
:secret_key_file => '/etc/openstack-dashboard/.secret_key_store',
:package_name => 'openstack-dashboard',
:root_url => '/dashboard',
:root_path => '/usr/share/openstack-dashboard',
:memcache_package => 'python3-memcached',
:pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'apache',
:wsgi_group => 'apache',
}
end
end