cache: support etcd3gw backend

This change introduces support to use ectd3gw backend as oslo.cache
backend, and makes the required backend package installed. The same
backend is already supported for coordination and this change leverage
the existing definitions added for coordination.

Change-Id: Id0eec018a68ab4a510307f150aa2a6ee017fa651
This commit is contained in:
Takashi Kajinami 2021-08-29 08:54:57 +09:00
parent cd984ba49f
commit d4b894a0a8
2 changed files with 38 additions and 2 deletions

View File

@ -204,6 +204,12 @@ define oslo::cache(
name => $::oslo::params::python_memcache_package_name,
tag => ['openstack'],
})
} elsif ($backend =~ /\.etcd3gw/ ) {
ensure_packages('python-etcd3gw', {
name => $::oslo::params::python_etcd3gw_package_name,
ensure => $package_ensure,
tag => 'openstack',
})
}
}

View File

@ -132,6 +132,34 @@ describe 'oslo::cache' do
end
end
context 'with etcd3gw backend' do
let :params do
{
:backend => 'oslo_cache.etcd3gw',
}
end
it 'configures cache backend' do
is_expected.to contain_keystone_config('cache/backend').with_value('oslo_cache.etcd3gw')
is_expected.to contain_package('python-etcd3gw').with(
:name => platform_params[:python_etcd3gw_package_name],
:tag => ['openstack'],
)
end
context 'with backend package management disabled' do
before do
params.merge!({
:manage_backend_package => false,
})
end
it 'does not install backend package' do
is_expected.not_to contain_package('python-etcd3gw')
end
end
end
context 'with string in list parameters' do
let :params do
{
@ -161,10 +189,12 @@ describe 'oslo::cache' do
case facts[:osfamily]
when 'Debian'
{ :pylibmc_package_name => 'python3-pylibmc',
:python_memcache_package_name => 'python3-memcache' }
:python_memcache_package_name => 'python3-memcache',
:python_etcd3gw_package_name => 'python3-etcd3gw' }
when 'RedHat'
{ :pylibmc_package_name => 'python3-pylibmc',
:python_memcache_package_name => 'python3-memcached' }
:python_memcache_package_name => 'python3-memcached',
:python_etcd3gw_package_name => 'python3-etcd3gw' }
end
end