diff --git a/manifests/params.pp b/manifests/params.pp index 84259a94..aa58da66 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,44 +4,30 @@ # class gnocchi::params { include ::openstacklib::defaults + $pyvers = $::openstacklib::defaults::pyvers - if ($::os_package_type == 'debian') or ($::os['name'] == 'Fedora') or - ($::os['family'] == 'RedHat' and Integer.new($::os['release']['major']) > 7) { - $pyvers = '3' - } else { - $pyvers = '' - } - - $client_package_name = "python${pyvers}-gnocchiclient" - $rados_package_name = "python${pyvers}-rados" - $common_package_name = 'gnocchi-common' - $api_service_name = 'gnocchi-api' - $metricd_package_name = 'gnocchi-metricd' - $metricd_service_name = 'gnocchi-metricd' - $statsd_package_name = 'gnocchi-statsd' - $statsd_service_name = 'gnocchi-statsd' - $group = 'gnocchi' + $client_package_name = "python${pyvers}-gnocchiclient" + $rados_package_name = "python${pyvers}-rados" + $common_package_name = 'gnocchi-common' + $api_package_name = 'gnocchi-api' + $api_service_name = 'gnocchi-api' + $metricd_package_name = 'gnocchi-metricd' + $metricd_service_name = 'gnocchi-metricd' + $statsd_package_name = 'gnocchi-statsd' + $statsd_service_name = 'gnocchi-statsd' + $group = 'gnocchi' + $gnocchi_wsgi_script_source = '/usr/bin/gnocchi-api' case $::osfamily { 'RedHat': { - $api_package_name = 'gnocchi-api' $sqlite_package_name = undef $indexer_package_name = 'openstack-gnocchi-indexer-sqlalchemy' $gnocchi_wsgi_script_path = '/var/www/cgi-bin/gnocchi' - $gnocchi_wsgi_script_source = '/usr/bin/gnocchi-api' $pymysql_package_name = undef $cradox_package_name = "python${pyvers}-cradox" $redis_package_name = "python${pyvers}-redis" } 'Debian': { - if $::os_package_type == 'debian' { - $api_package_name = 'gnocchi-api' - $gnocchi_wsgi_script_source = '/usr/bin/gnocchi-api' - } else { - $api_package_name = 'python-gnocchi' - $gnocchi_wsgi_script_source = '/usr/bin/python2-gnocchi-api' - } - $sqlite_package_name = 'python-pysqlite2' $gnocchi_wsgi_script_path = '/usr/lib/cgi-bin/gnocchi' $pymysql_package_name = "python${pyvers}-pymysql" diff --git a/manifests/storage.pp b/manifests/storage.pp index 00528587..09ff4061 100644 --- a/manifests/storage.pp +++ b/manifests/storage.pp @@ -49,15 +49,6 @@ class gnocchi::storage( name => $::gnocchi::params::redis_package_name, tag => 'openstack', }) - - # NOTE(tobias.urdin): Gnocchi components are packaged with py3 in Ubuntu - # from Queens. - if $::operatingsystem == 'Ubuntu' { - ensure_resource('package', 'python3-redis', { - name => 'python3-redis', - tag => 'openstack', - }) - } } } } diff --git a/manifests/storage/ceph.pp b/manifests/storage/ceph.pp index 2c800f12..bae178dc 100644 --- a/manifests/storage/ceph.pp +++ b/manifests/storage/ceph.pp @@ -105,16 +105,6 @@ class gnocchi::storage::ceph( 'name' => $::gnocchi::params::rados_package_name, 'tag' => ['openstack','gnocchi-package'], }) - - # NOTE(tobias.urdin): Gnocchi components are packaged with py3 in Ubuntu - # from Queens. - if $::operatingsystem == 'Ubuntu' { - ensure_packages('python3-rados', { - 'ensure' => 'present', - 'name' => 'python3-rados', - 'tag' => ['openstack','gnocchi-package'], - }) - } } } } diff --git a/spec/classes/gnocchi_api_spec.rb b/spec/classes/gnocchi_api_spec.rb index 8414d34c..96d03a66 100644 --- a/spec/classes/gnocchi_api_spec.rb +++ b/spec/classes/gnocchi_api_spec.rb @@ -180,11 +180,7 @@ describe 'gnocchi::api' do let(:platform_params) do case facts[:osfamily] when 'Debian' - if facts[:os_package_type] == 'debian' then - package_name = 'gnocchi-api' - else - package_name = 'python-gnocchi' - end + package_name = 'gnocchi-api' when 'RedHat' package_name = 'gnocchi-api' end diff --git a/spec/classes/gnocchi_client_spec.rb b/spec/classes/gnocchi_client_spec.rb index dc2c9005..e2b13b8e 100644 --- a/spec/classes/gnocchi_client_spec.rb +++ b/spec/classes/gnocchi_client_spec.rb @@ -1,19 +1,15 @@ require 'spec_helper' describe 'gnocchi::client' do - - shared_examples_for 'gnocchi client' do - + shared_examples 'gnocchi::client' do it { is_expected.to contain_class('gnocchi::deps') } it { is_expected.to contain_class('gnocchi::params') } - it 'installs gnocchi client package' do - is_expected.to contain_package('python-gnocchiclient').with( - :ensure => 'present', - :name => platform_params[:client_package_name], - :tag => 'openstack', - ) - end + it { should contain_package('python-gnocchiclient').with( + :ensure => 'present', + :name => platform_params[:client_package_name], + :tag => 'openstack', + )} end on_supported_os({ @@ -27,18 +23,13 @@ describe 'gnocchi::client' do let(:platform_params) do case facts[:osfamily] when 'Debian' - if facts[:os_package_type] == 'debian' - { :client_package_name => 'python3-gnocchiclient' } - else - { :client_package_name => 'python-gnocchiclient' } - end + { :client_package_name => 'python3-gnocchiclient' } when 'RedHat' { :client_package_name => 'python-gnocchiclient' } end end - it_behaves_like 'gnocchi client' + it_behaves_like 'gnocchi::client' end end - end diff --git a/spec/classes/gnocchi_db_spec.rb b/spec/classes/gnocchi_db_spec.rb index 6d1f018b..5a5b79bf 100644 --- a/spec/classes/gnocchi_db_spec.rb +++ b/spec/classes/gnocchi_db_spec.rb @@ -108,13 +108,8 @@ describe 'gnocchi::db' do let(:platform_params) do case facts[:osfamily] when 'Debian' - if facts[:os_package_type] == 'debian' then - pymysql_pkg = 'python3-pymysql' - else - pymysql_pkg = 'python-pymysql' - end { - :pymysql_package_name => pymysql_pkg, + :pymysql_package_name => 'python3-pymysql', } end end diff --git a/spec/classes/gnocchi_storage_ceph_spec.rb b/spec/classes/gnocchi_storage_ceph_spec.rb index 3d8d749a..f0ffe2af 100644 --- a/spec/classes/gnocchi_storage_ceph_spec.rb +++ b/spec/classes/gnocchi_storage_ceph_spec.rb @@ -86,8 +86,6 @@ describe 'gnocchi::storage::ceph' do 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('python3-rados') } - end end @@ -105,20 +103,6 @@ describe 'gnocchi::storage::ceph' do end end - shared_examples 'gnocchi storage ceph ubuntu' do - context 'with manage_rados set to true installs python3-rados on Ubuntu' do - before do - params.merge!({ - :manage_cradox => false, - :manage_rados => true, - }) - end - - it { is_expected.to contain_package('python3-rados').with(:ensure => 'present') } - - end - end - on_supported_os({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts| @@ -134,10 +118,6 @@ describe 'gnocchi::storage::ceph' do it_behaves_like 'gnocchi storage ceph cradox redhat' end - if facts[:operatingsystem] == 'Ubuntu' then - it_behaves_like 'gnocchi storage ceph ubuntu' - end - it_behaves_like 'gnocchi storage ceph' end end diff --git a/spec/classes/gnocchi_storage_spec.rb b/spec/classes/gnocchi_storage_spec.rb index efc833e3..36bd6d90 100644 --- a/spec/classes/gnocchi_storage_spec.rb +++ b/spec/classes/gnocchi_storage_spec.rb @@ -25,7 +25,7 @@ describe 'gnocchi::storage' do end it 'installs python-redis package' do - is_expected.to contain_package(platform_params[:redis_package_name]).with( + is_expected.to contain_package('python-redis').with( :name => platform_params[:redis_package_name], :tag => 'openstack' ) @@ -33,24 +33,6 @@ describe 'gnocchi::storage' do end end - shared_examples_for 'gnocchi-storage ubuntu' do - context 'with coordination set on ubuntu' do - before do - params.merge!({ - :coordination_url => 'redis://localhost:6379', - :metric_processing_delay => 30, - }) - end - - it 'installs python3-redis package' do - is_expected.to contain_package('python3-redis').with( - :name => 'python3-redis', - :tag => 'openstack' - ) - end - end - end - on_supported_os({ :supported_os => OSDefaults.get_supported_os }).each do |os,facts| @@ -62,16 +44,12 @@ describe 'gnocchi::storage' do let(:platform_params) do case facts[:osfamily] when 'Debian' - { :redis_package_name => 'python-redis' } + { :redis_package_name => 'python3-redis' } when 'RedHat' - { :redis_package_name => 'python-redis' } + { :redis_package_name => 'python-redis' } end end - if facts[:operatingsystem] == 'Ubuntu' then - it_behaves_like 'gnocchi-storage ubuntu' - end - it_behaves_like 'gnocchi-storage' end end diff --git a/spec/classes/gnocchi_wsgi_apache_spec.rb b/spec/classes/gnocchi_wsgi_apache_spec.rb index e040dced..155b481b 100644 --- a/spec/classes/gnocchi_wsgi_apache_spec.rb +++ b/spec/classes/gnocchi_wsgi_apache_spec.rb @@ -92,16 +92,11 @@ describe 'gnocchi::wsgi::apache' do let(:platform_params) do case facts[:osfamily] when 'Debian' - if facts[:os_package_type] == 'debian' then - script_source = '/usr/bin/gnocchi-api' - else - script_source = '/usr/bin/python2-gnocchi-api' - end { :httpd_service_name => 'apache2', :httpd_ports_file => '/etc/apache2/ports.conf', :wsgi_script_path => '/usr/lib/cgi-bin/gnocchi', - :wsgi_script_source => script_source + :wsgi_script_source => '/usr/bin/gnocchi-api' } when 'RedHat' {