coordination: Expose parameters for package management

Change-Id: I7fc4340fe96be7b2bf3364eb47e2a0f2620549fd
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-10-02 14:54:14 +09:00
parent 003181251c
commit ad1bfa0242
3 changed files with 47 additions and 11 deletions

View File

@@ -17,10 +17,20 @@
# in the gnocchi config.
# Defaults to false.
#
# [*manage_backend_package*]
# (Optional) Whether to install the backend package.
# Defaults to true.
#
# [*backend_package_ensure*]
# (Optional) ensure state for backend package.
# Defaults to 'present'
#
class gnocchi (
Stdlib::Ensure::Package $package_ensure = 'present',
$coordination_url = $facts['os_service_default'],
Boolean $purge_config = false,
Stdlib::Ensure::Package $package_ensure = 'present',
$coordination_url = $facts['os_service_default'],
Boolean $purge_config = false,
Boolean $manage_backend_package = true,
Stdlib::Ensure::Package $backend_package_ensure = present,
) inherits gnocchi::params {
include gnocchi::deps
@@ -35,8 +45,10 @@ class gnocchi (
}
oslo::coordination { 'gnocchi_config':
backend_url => $coordination_url,
manage_config => false,
backend_url => $coordination_url,
manage_backend_package => $manage_backend_package,
package_ensure => $backend_package_ensure,
manage_config => false,
}
gnocchi_config {
'DEFAULT/coordination_url' : value => $coordination_url, secret => true;

View File

@@ -0,0 +1,7 @@
---
features:
- |
The following parameters have been added to the ``gnocchi`` class.
- ``manage_backend_package``
- ``backend_package_ensure``

View File

@@ -30,16 +30,23 @@ describe 'gnocchi' do
it 'does not configure coordination_url' do
is_expected.to contain_gnocchi_config('DEFAULT/coordination_url').with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_oslo__coordination('gnocchi_config').with(
:backend_url => '<SERVICE DEFAULT>',
:manage_config => false,
:backend_url => '<SERVICE DEFAULT>',
:manage_backend_package => true,
:package_ensure => 'present',
:manage_config => false,
)
end
end
context 'with overridden parameters' do
let :params do
{ :purge_config => true,
:coordination_url => 'redis://localhost:6379', }
{
:purge_config => true,
:coordination_url => 'redis://localhost:6379',
:package_ensure => 'installed',
:manage_backend_package => false,
:backend_package_ensure => 'latest',
}
end
it 'purges gnocchi config' do
@@ -48,11 +55,21 @@ describe 'gnocchi' do
})
end
it 'installs packages' do
is_expected.to contain_package('gnocchi').with(
:name => platform_params[:gnocchi_common_package],
:ensure => 'installed',
:tag => ['openstack', 'gnocchi-package']
)
end
it 'configures coordination' do
is_expected.to contain_gnocchi_config('DEFAULT/coordination_url').with_value('redis://localhost:6379').with_secret(true)
is_expected.to contain_oslo__coordination('gnocchi_config').with(
:backend_url => 'redis://localhost:6379',
:manage_config => false,
:backend_url => 'redis://localhost:6379',
:manage_backend_package => false,
:package_ensure => 'latest',
:manage_config => false,
)
end
end