Change ubuntu to py3

Change-Id: I3bc422abeb49fe068d6013333101366d0071ebab
This commit is contained in:
Tobias Urdin 2018-12-12 21:19:26 +01:00
parent 6b21f1b4ce
commit a0fccec778
9 changed files with 26 additions and 124 deletions

View File

@ -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"

View File

@ -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',
})
}
}
}
}

View File

@ -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'],
})
}
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'
{