Make sure python3-redis is installed

... when RedisCache is used

Change-Id: Iaf5dae66cfbc505fdd829630eaec9127b4185247
This commit is contained in:
Takashi Kajinami 2024-04-17 14:18:55 +09:00
parent 767b076e90
commit a802b575de
3 changed files with 69 additions and 30 deletions

View File

@ -695,6 +695,14 @@ Use PyMemcacheCache backend instead")
Anchor['horizon::install::begin'] Anchor['horizon::install::begin']
-> Package<| name == $::horizon::params::pymemcache_package |> -> Package<| name == $::horizon::params::pymemcache_package |>
-> Anchor['horizon::install::end'] -> 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' $wsgi_group = 'apache'
$memcache_package = 'python3-memcached' $memcache_package = 'python3-memcached'
$pymemcache_package = 'python3-pymemcache' $pymemcache_package = 'python3-pymemcache'
$python_redis_package = 'python3-redis'
$designate_dashboard_package_name = 'openstack-designate-ui' $designate_dashboard_package_name = 'openstack-designate-ui'
$heat_dashboard_package_name = 'openstack-heat-ui' $heat_dashboard_package_name = 'openstack-heat-ui'
$ironic_dashboard_package_name = 'openstack-ironic-ui' $ironic_dashboard_package_name = 'openstack-ironic-ui'
@ -41,6 +42,7 @@ class horizon::params {
$wsgi_group = 'horizon' $wsgi_group = 'horizon'
$memcache_package = 'python3-memcache' $memcache_package = 'python3-memcache'
$pymemcache_package = 'python3-pymemcache' $pymemcache_package = 'python3-pymemcache'
$python_redis_package = 'python3-redis'
$designate_dashboard_package_name = 'python3-designate-dashboard' $designate_dashboard_package_name = 'python3-designate-dashboard'
$heat_dashboard_package_name = 'python3-heat-dashboard' $heat_dashboard_package_name = 'python3-heat-dashboard'
$ironic_dashboard_package_name = 'python3-ironic-ui' $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') } it { is_expected.not_to contain_package('python-pymemcache') }
end 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 context 'with custom wsgi options' do
before do before do
params.merge!( :wsgi_processes => '30', params.merge!( :wsgi_processes => '30',
@ -803,6 +829,7 @@ describe 'horizon' do
:root_path => '/var/lib/openstack-dashboard', :root_path => '/var/lib/openstack-dashboard',
:memcache_package => 'python3-memcache', :memcache_package => 'python3-memcache',
:pymemcache_package => 'python3-pymemcache', :pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'horizon', :wsgi_user => 'horizon',
:wsgi_group => 'horizon', :wsgi_group => 'horizon',
} }
@ -815,6 +842,7 @@ describe 'horizon' do
:root_path => '/var/lib/openstack-dashboard', :root_path => '/var/lib/openstack-dashboard',
:memcache_package => 'python3-memcache', :memcache_package => 'python3-memcache',
:pymemcache_package => 'python3-pymemcache', :pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'horizon', :wsgi_user => 'horizon',
:wsgi_group => 'horizon', :wsgi_group => 'horizon',
} }
@ -828,6 +856,7 @@ describe 'horizon' do
:root_path => '/usr/share/openstack-dashboard', :root_path => '/usr/share/openstack-dashboard',
:memcache_package => 'python3-memcached', :memcache_package => 'python3-memcached',
:pymemcache_package => 'python3-pymemcache', :pymemcache_package => 'python3-pymemcache',
:python_redis_package => 'python3-redis',
:wsgi_user => 'apache', :wsgi_user => 'apache',
:wsgi_group => 'apache', :wsgi_group => 'apache',
} }