Deprecated manage_cradox and set manage_rados to true

The [1] commit changed the ordering in Gnocchi so that
the rados library is preferred over cradox that is no
longer maintained and hasn't been updated in a long time.

Cradox is no longer tested in upstream Gnocchi and support
was removed in [2] which is not yet released.

This patch also changes the default value for manage_rados
to true so that it's manage by default since it's the one
preferred.

[1] d5a782e58f (diff-60cbc467d17fe0479d5cb2292f716fd73b200973ae43889f72c51227d311a785)
[2] bf37e90eda (diff-60cbc467d17fe0479d5cb2292f716fd73b200973ae43889f72c51227d311a785)

Change-Id: Id1957e4d6e5ad003592ad46e469ec9f9e78ad58d
This commit is contained in:
Tobias Urdin 2021-05-26 11:24:09 +02:00
parent 064f1554ad
commit 3591bd8acc
4 changed files with 34 additions and 87 deletions

View File

@ -23,7 +23,6 @@ class gnocchi::params {
$indexer_package_name = 'openstack-gnocchi-indexer-sqlalchemy' $indexer_package_name = 'openstack-gnocchi-indexer-sqlalchemy'
$gnocchi_wsgi_script_path = '/var/www/cgi-bin/gnocchi' $gnocchi_wsgi_script_path = '/var/www/cgi-bin/gnocchi'
$pymysql_package_name = undef $pymysql_package_name = undef
$cradox_package_name = 'python3-cradox'
$redis_package_name = 'python3-redis' $redis_package_name = 'python3-redis'
} }
'Debian': { 'Debian': {
@ -31,7 +30,6 @@ class gnocchi::params {
$indexer_package_name = undef $indexer_package_name = undef
$gnocchi_wsgi_script_path = '/usr/lib/cgi-bin/gnocchi' $gnocchi_wsgi_script_path = '/usr/lib/cgi-bin/gnocchi'
$pymysql_package_name = 'python3-pymysql' $pymysql_package_name = 'python3-pymysql'
$cradox_package_name = undef
$redis_package_name = 'python3-redis' $redis_package_name = 'python3-redis'
} }
default: { default: {

View File

@ -40,18 +40,18 @@
# (optional) Ceph configuration file. # (optional) Ceph configuration file.
# Defaults to '/etc/ceph/ceph.conf'. # Defaults to '/etc/ceph/ceph.conf'.
# #
# [*manage_rados*]
# (optional) Ensure state of the rados python package.
# Defaults to true.
#
# == DEPRECATED PARAMS
#
# [*manage_cradox*] # [*manage_cradox*]
# (optional) Ensure state of the cradox package. # (optional) Ensure state of the cradox package.
# As of ceph jewel the python-rados package should be used. Option # As of ceph jewel the python-rados package should be used. Option
# must be set to false for Ubuntu as there is no cradox package for # must be set to false for Ubuntu as there is no cradox package for
# Ubuntu. # Ubuntu.
# Defaults to true. # Defaults to undef.
#
# [*manage_rados*]
# (optional) Ensure state of the rados python package.
# This option must be set to true for Ubuntu as there is no cradox
# package available for Ubuntu.
# Defaults to false.
# #
class gnocchi::storage::ceph( class gnocchi::storage::ceph(
$ceph_username, $ceph_username,
@ -59,26 +59,21 @@ class gnocchi::storage::ceph(
$ceph_secret = $::os_service_default, $ceph_secret = $::os_service_default,
$ceph_pool = 'gnocchi', $ceph_pool = 'gnocchi',
$ceph_conffile = '/etc/ceph/ceph.conf', $ceph_conffile = '/etc/ceph/ceph.conf',
$manage_cradox = true, $manage_rados = true,
$manage_rados = false, ## DEPRECATED PARAMS
$manage_cradox = undef,
) inherits gnocchi::params { ) inherits gnocchi::params {
include gnocchi::deps include gnocchi::deps
if $manage_cradox != undef {
warning('gnocchi::storage::ceph::manage_cradox parameter is deprecated and has no effect')
}
if (is_service_default($ceph_keyring) and is_service_default($ceph_secret)) or (! $ceph_keyring and ! $ceph_secret) { if (is_service_default($ceph_keyring) and is_service_default($ceph_secret)) or (! $ceph_keyring and ! $ceph_secret) {
fail('You need to specify either gnocchi::storage::ceph::ceph_keyring or gnocchi::storage::ceph::ceph_secret.') fail('You need to specify either gnocchi::storage::ceph::ceph_keyring or gnocchi::storage::ceph::ceph_secret.')
} }
if $manage_rados and $manage_cradox {
fail('gnocchi::storage::ceph::manage_rados and gnocchi::storage::ceph::manage_cradox both cannot be set to true.')
}
if $manage_cradox {
if $::gnocchi::params::cradox_package_name == undef {
fail('gnocchi::storage::ceph::manage_cradox set to true will fail due to no package being available.')
}
}
gnocchi_config { gnocchi_config {
'storage/driver': value => 'ceph'; 'storage/driver': value => 'ceph';
'storage/ceph_username': value => $ceph_username; 'storage/ceph_username': value => $ceph_username;
@ -88,14 +83,6 @@ class gnocchi::storage::ceph(
'storage/ceph_conffile': value => $ceph_conffile; 'storage/ceph_conffile': value => $ceph_conffile;
} }
if $manage_cradox {
ensure_packages('python-cradox', {
'ensure' => 'present',
'name' => $::gnocchi::params::cradox_package_name,
'tag' => ['openstack','gnocchi-package'],
})
}
if $manage_rados { if $manage_rados {
ensure_packages('python-rados', { ensure_packages('python-rados', {
'ensure' => 'present', 'ensure' => 'present',

View File

@ -0,0 +1,9 @@
---
upgrade:
- |
The gnocchi::storage::ceph::manage_rados parameters default value is now
true.
deprecations:
- |
The gnocchi::storage::ceph::manage_cradox parameter is deprecated and has
no effect.

View File

@ -9,12 +9,10 @@ describe 'gnocchi::storage::ceph' do
{ {
:ceph_username => 'joe', :ceph_username => 'joe',
:ceph_keyring => 'client.admin', :ceph_keyring => 'client.admin',
:manage_cradox => false,
:manage_rados => true,
} }
end end
shared_examples 'gnocchi storage ceph' do shared_examples 'gnocchi::storage::ceph' do
context 'with default parameters' do context 'with default parameters' do
it 'configures gnocchi-api with default parameters' do it 'configures gnocchi-api with default parameters' do
@ -24,6 +22,12 @@ describe 'gnocchi::storage::ceph' do
is_expected.to contain_gnocchi_config('storage/ceph_pool').with_value('gnocchi') is_expected.to contain_gnocchi_config('storage/ceph_pool').with_value('gnocchi')
is_expected.to contain_gnocchi_config('storage/ceph_conffile').with_value('/etc/ceph/ceph.conf') is_expected.to contain_gnocchi_config('storage/ceph_conffile').with_value('/etc/ceph/ceph.conf')
end end
it { is_expected.to contain_package('python-rados').with(
:ensure => 'present',
:name => 'python3-rados',
:tag => ['openstack', 'gnocchi-package'],
)}
end end
context 'with ceph_secret parameter' do context 'with ceph_secret parameter' do
@ -31,6 +35,7 @@ describe 'gnocchi::storage::ceph' do
params.merge!({ params.merge!({
:ceph_secret => 'secrete'}) :ceph_secret => 'secrete'})
end end
it { is_expected.to contain_gnocchi_config('storage/ceph_secret').with_value('secrete').with_secret(true) } it { is_expected.to contain_gnocchi_config('storage/ceph_secret').with_value('secrete').with_secret(true) }
end end
@ -49,60 +54,15 @@ describe 'gnocchi::storage::ceph' do
it { expect { is_expected.to raise_error(Puppet::Error) } } it { expect { is_expected.to raise_error(Puppet::Error) } }
end end
context 'with manage_rados to true' do context 'with manage_rados to false' do
before do before do
params.merge!({ params.merge!( :manage_rados => false )
:manage_cradox => false,
:manage_rados => true,
})
end end
it { is_expected.not_to contain_package('python-cradox') }
it { is_expected.to contain_package('python-rados').with(:ensure => 'present') }
end
context 'with manage_cradox and manage_rados to true' do
before do
params.merge!({
:manage_cradox => true,
:manage_rados => true,
})
end
it { is_expected.to raise_error(Puppet::Error, /gnocchi::storage::ceph::manage_rados and gnocchi::storage::ceph::manage_cradox both cannot be set to true./) }
end
end
shared_examples 'gnocchi storage ceph cradox redhat' do
context 'with manage_cradox to true' do
before do
params.merge!({
:manage_cradox => true,
:manage_rados => false,
})
end
it { is_expected.to contain_package('python-cradox').with(:ensure => 'present') }
it { is_expected.not_to contain_package('python-rados') } it { is_expected.not_to contain_package('python-rados') }
end end
end end
shared_examples 'gnocchi storage ceph cradox debian' do
context 'with manage_cradox to true' do
before do
params.merge!({
:manage_cradox => true,
:manage_rados => false,
})
end
it { is_expected.to raise_error(Puppet::Error, /gnocchi::storage::ceph::manage_cradox set to true will fail due to no package being available./) }
end
end
on_supported_os({ on_supported_os({
:supported_os => OSDefaults.get_supported_os :supported_os => OSDefaults.get_supported_os
}).each do |os,facts| }).each do |os,facts|
@ -111,14 +71,7 @@ describe 'gnocchi::storage::ceph' do
facts.merge!(OSDefaults.get_facts()) facts.merge!(OSDefaults.get_facts())
end end
case facts[:osfamily] it_behaves_like 'gnocchi::storage::ceph'
when 'Debian'
it_behaves_like 'gnocchi storage ceph cradox debian'
when 'RedHat'
it_behaves_like 'gnocchi storage ceph cradox redhat'
end
it_behaves_like 'gnocchi storage ceph'
end end
end end
end end