Use oslo::coordination to manage coordination backend packages

This change replaces current implementation to manage packages for
coordination backend by oslo::coordination resource type, so that we
can gather all logics related to coordination in a single place.

Because Gnocchi is not using a common parameter name, configuration
is still managed by gnocchi class.

Depends-on: https://review.opendev.org/792535
Change-Id: I9998d1351ec656fd2e4c0eee8de16f4c65d1aeb8
This commit is contained in:
Takashi Kajinami 2021-05-22 14:03:15 +09:00
parent 1888013f61
commit f0371cecf2
4 changed files with 13 additions and 30 deletions

View File

@ -35,15 +35,11 @@ class gnocchi (
purge => $purge_config,
}
oslo::coordination{ 'gnocchi_config':
backend_url => $coordination_url,
manage_config => false,
}
gnocchi_config {
'DEFAULT/coordination_url' : value => $coordination_url;
}
if ($coordination_url =~ /^redis/ ) {
ensure_packages('python-redis', {
ensure => $package_ensure,
name => $::gnocchi::params::redis_package_name,
tag => 'openstack',
})
}
}

View File

@ -23,14 +23,12 @@ class gnocchi::params {
$indexer_package_name = 'openstack-gnocchi-indexer-sqlalchemy'
$gnocchi_wsgi_script_path = '/var/www/cgi-bin/gnocchi'
$pymysql_package_name = undef
$redis_package_name = 'python3-redis'
}
'Debian': {
$sqlite_package_name = 'python-pysqlite2'
$indexer_package_name = undef
$gnocchi_wsgi_script_path = '/usr/lib/cgi-bin/gnocchi'
$pymysql_package_name = 'python3-pymysql'
$redis_package_name = 'python3-redis'
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem")

View File

@ -29,7 +29,10 @@ describe 'gnocchi' do
it 'does not configure coordination_url' do
is_expected.to contain_gnocchi_config('DEFAULT/coordination_url').with_value('<SERVICE DEFAULT>')
is_expected.to_not contain_package('python-redis')
is_expected.to contain_oslo__coordination('gnocchi_config').with(
:backend_url => '<SERVICE DEFAULT>',
:manage_config => false,
)
end
end
@ -47,10 +50,9 @@ describe 'gnocchi' do
it 'cnfigures coordination' do
is_expected.to contain_gnocchi_config('DEFAULT/coordination_url').with_value('redis://localhost:6379')
is_expected.to contain_package('python-redis').with(
:name => platform_params[:redis_package_name],
:ensure => 'present',
:tag => 'openstack'
is_expected.to contain_oslo__coordination('gnocchi_config').with(
:backend_url => 'redis://localhost:6379',
:manage_config => false,
)
end
end
@ -67,13 +69,9 @@ describe 'gnocchi' do
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :gnocchi_common_package => 'gnocchi-common',
:redis_package_name => 'python3-redis'
}
{ :gnocchi_common_package => 'gnocchi-common' }
when 'RedHat'
{ :gnocchi_common_package => 'gnocchi-common',
:redis_package_name => 'python3-redis'
}
{ :gnocchi_common_package => 'gnocchi-common' }
end
end
it_behaves_like 'gnocchi'

View File

@ -14,15 +14,6 @@ describe 'gnocchi::storage' do
facts.merge!(OSDefaults.get_facts())
end
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
{ :redis_package_name => 'python3-redis' }
when 'RedHat'
{ :redis_package_name => 'python3-redis' }
end
end
it_behaves_like 'gnocchi-storage'
end
end