From 3591bd8acc1ac49feb2f0fa33a45a09e94e08407 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 26 May 2021 11:24:09 +0200 Subject: [PATCH] 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] https://github.com/gnocchixyz/gnocchi/commit/d5a782e58fc5b3593672fb9c8ac86fddc0c0dedf#diff-60cbc467d17fe0479d5cb2292f716fd73b200973ae43889f72c51227d311a785 [2] https://github.com/gnocchixyz/gnocchi/commit/bf37e90edaa693880a6f025b1c9329579a7b9882#diff-60cbc467d17fe0479d5cb2292f716fd73b200973ae43889f72c51227d311a785 Change-Id: Id1957e4d6e5ad003592ad46e469ec9f9e78ad58d --- manifests/params.pp | 2 - manifests/storage/ceph.pp | 41 ++++------- ...ecated-manage-cradox-6a4052d270c5180e.yaml | 9 +++ spec/classes/gnocchi_storage_ceph_spec.rb | 69 +++---------------- 4 files changed, 34 insertions(+), 87 deletions(-) create mode 100644 releasenotes/notes/deprecated-manage-cradox-6a4052d270c5180e.yaml diff --git a/manifests/params.pp b/manifests/params.pp index 7cc401c2..7eb31a62 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -23,7 +23,6 @@ class gnocchi::params { $indexer_package_name = 'openstack-gnocchi-indexer-sqlalchemy' $gnocchi_wsgi_script_path = '/var/www/cgi-bin/gnocchi' $pymysql_package_name = undef - $cradox_package_name = 'python3-cradox' $redis_package_name = 'python3-redis' } 'Debian': { @@ -31,7 +30,6 @@ class gnocchi::params { $indexer_package_name = undef $gnocchi_wsgi_script_path = '/usr/lib/cgi-bin/gnocchi' $pymysql_package_name = 'python3-pymysql' - $cradox_package_name = undef $redis_package_name = 'python3-redis' } default: { diff --git a/manifests/storage/ceph.pp b/manifests/storage/ceph.pp index 75f28d1d..d7e61db9 100644 --- a/manifests/storage/ceph.pp +++ b/manifests/storage/ceph.pp @@ -40,18 +40,18 @@ # (optional) Ceph configuration file. # Defaults to '/etc/ceph/ceph.conf'. # +# [*manage_rados*] +# (optional) Ensure state of the rados python package. +# Defaults to true. +# +# == DEPRECATED PARAMS +# # [*manage_cradox*] # (optional) Ensure state of the cradox package. # 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 # Ubuntu. -# Defaults to true. -# -# [*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. +# Defaults to undef. # class gnocchi::storage::ceph( $ceph_username, @@ -59,26 +59,21 @@ class gnocchi::storage::ceph( $ceph_secret = $::os_service_default, $ceph_pool = 'gnocchi', $ceph_conffile = '/etc/ceph/ceph.conf', - $manage_cradox = true, - $manage_rados = false, + $manage_rados = true, + ## DEPRECATED PARAMS + $manage_cradox = undef, ) inherits gnocchi::params { 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) { 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 { 'storage/driver': value => 'ceph'; 'storage/ceph_username': value => $ceph_username; @@ -88,14 +83,6 @@ class gnocchi::storage::ceph( '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 { ensure_packages('python-rados', { 'ensure' => 'present', diff --git a/releasenotes/notes/deprecated-manage-cradox-6a4052d270c5180e.yaml b/releasenotes/notes/deprecated-manage-cradox-6a4052d270c5180e.yaml new file mode 100644 index 00000000..c52d1752 --- /dev/null +++ b/releasenotes/notes/deprecated-manage-cradox-6a4052d270c5180e.yaml @@ -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. diff --git a/spec/classes/gnocchi_storage_ceph_spec.rb b/spec/classes/gnocchi_storage_ceph_spec.rb index fc75694d..99f05eea 100644 --- a/spec/classes/gnocchi_storage_ceph_spec.rb +++ b/spec/classes/gnocchi_storage_ceph_spec.rb @@ -9,12 +9,10 @@ describe 'gnocchi::storage::ceph' do { :ceph_username => 'joe', :ceph_keyring => 'client.admin', - :manage_cradox => false, - :manage_rados => true, } end - shared_examples 'gnocchi storage ceph' do + shared_examples 'gnocchi::storage::ceph' do context '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_conffile').with_value('/etc/ceph/ceph.conf') end + + it { is_expected.to contain_package('python-rados').with( + :ensure => 'present', + :name => 'python3-rados', + :tag => ['openstack', 'gnocchi-package'], + )} end context 'with ceph_secret parameter' do @@ -31,6 +35,7 @@ describe 'gnocchi::storage::ceph' do params.merge!({ :ceph_secret => 'secrete'}) end + it { is_expected.to contain_gnocchi_config('storage/ceph_secret').with_value('secrete').with_secret(true) } end @@ -49,60 +54,15 @@ describe 'gnocchi::storage::ceph' do it { expect { is_expected.to raise_error(Puppet::Error) } } end - context 'with manage_rados to true' do + context 'with manage_rados to false' do before do - params.merge!({ - :manage_cradox => false, - :manage_rados => true, - }) + params.merge!( :manage_rados => false ) 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') } 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({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts| @@ -111,14 +71,7 @@ describe 'gnocchi::storage::ceph' do facts.merge!(OSDefaults.get_facts()) end - case facts[:osfamily] - 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' + it_behaves_like 'gnocchi::storage::ceph' end end end