coordination: Allow disabling management of backend package

... which is already implemented in other resources like oslo::cache.

Change-Id: I459b7b752a83f75b1cb05c2104812133039a9162
This commit is contained in:
Takashi Kajinami 2021-08-29 11:42:34 +09:00
parent b05244e2a1
commit 872883d7f5
3 changed files with 74 additions and 4 deletions

View File

@ -8,6 +8,10 @@
# (Optional) Coordination backend URL.
# Defaults to $::os_service_default
#
# [*manage_backend_package*]
# (Optional) Whether to install the backend package.
# Defaults to true.
#
# [*package_ensure*]
# (Optional) ensure state for package.
# Defaults to 'present'
@ -17,14 +21,15 @@
# Defaults to true.
#
define oslo::coordination (
$backend_url = $::os_service_default,
$package_ensure = 'present',
$manage_config = true,
$backend_url = $::os_service_default,
$manage_backend_package = true,
$package_ensure = 'present',
$manage_config = true,
) {
include oslo::params
if !is_service_default($backend_url) {
if $manage_backend_package and !is_service_default($backend_url){
case $backend_url {
/^redis:\/\//: {
ensure_packages('python-redis', {

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``oslo::coordination::manage_backend_package`` parameter has been
added.

View File

@ -26,6 +26,18 @@ describe 'oslo::coordination' do
: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.to_not contain_package('python-redis')
end
end
end
context 'with etcd3 backend' do
@ -46,6 +58,18 @@ describe 'oslo::coordination' do
is_expected.to_not contain_package('python-etcd3')
end
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.to_not contain_package('python-etcd3')
end
end
end
context 'with etcd3gw backend(http)' do
@ -57,6 +81,18 @@ describe 'oslo::coordination' do
is_expected.to contain_keystone_config('coordination/backend_url').with_value('etcd3+http://localhost:2379')
is_expected.to contain_package('python-etcd3gw')
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.to_not contain_package('python-etcd3gw')
end
end
end
context 'with etcd3gw backend(https)' do
@ -68,6 +104,18 @@ describe 'oslo::coordination' do
is_expected.to contain_keystone_config('coordination/backend_url').with_value('etcd3+https://localhost:2379')
is_expected.to contain_package('python-etcd3gw')
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.to_not contain_package('python-etcd3gw')
end
end
end
context 'with memcache backend' do
@ -84,6 +132,18 @@ describe 'oslo::coordination' do
: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.to_not contain_package('python-pymemcache')
end
end
end
context 'with configuration management disabled' do