Browse Source

Inherit pyvers from openstacklib::defaults

Change-Id: Iadc74eaa42c6beb425fbf552c0b25f328ae94c86
changes/23/631523/3
Tobias Urdin 3 years ago
parent
commit
7742cb2fb0
  1. 2
      manifests/db.pp
  2. 14
      manifests/params.pp
  3. 12
      spec/defines/oslo_cache_spec.rb
  4. 33
      spec/defines/oslo_db_spec.rb

2
manifests/db.pp

@ -123,7 +123,7 @@ define oslo::db(
$db_max_retry_interval = $::os_service_default,
$db_max_retries = $::os_service_default,
$use_tpool = $::os_service_default,
){
) {
include ::oslo::params

14
manifests/params.pp

@ -4,12 +4,8 @@
#
class oslo::params {
include ::openstacklib::defaults
$pyvers = $::openstacklib::defaults::pyvers
if ($::os_package_type == 'debian') {
$pyvers = '3'
} else {
$pyvers = ''
}
$pymongo_package_name = "python${pyvers}-pymongo"
$pylibmc_package_name = "python${pyvers}-pylibmc"
@ -17,12 +13,12 @@ class oslo::params {
'RedHat': {
$sqlite_package_name = undef
$pymysql_package_name = undef
$python_memcache_package_name = 'python-memcached'
$python_memcache_package_name = "python${pyvers}-memcached"
}
'Debian': {
$sqlite_package_name = 'python-pysqlite2'
$pymysql_package_name = 'python-pymysql'
$python_memcache_package_name = 'python-memcache'
$sqlite_package_name = "python${pyvers}-pysqlite2"
$pymysql_package_name = "python${pyvers}-pymysql"
$python_memcache_package_name = "python${pyvers}-memcache"
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem")

12
spec/defines/oslo_cache_spec.rb

@ -144,22 +144,14 @@ describe 'oslo::cache' do
let(:platform_params) do
case facts[:osfamily]
when 'Debian'
if facts[:os_package_type] == 'debian'
platform_params = { :pylibmc_package_name => 'python3-pylibmc' }
else
platform_params = { :pylibmc_package_name => 'python-pylibmc' }
end
platform_params = { :pylibmc_package_name => 'python3-pylibmc' }
when 'RedHat'
platform_params = { :pylibmc_package_name => 'python-pylibmc' }
end
case facts[:osfamily]
when 'Debian'
if facts[:os_package_type] == 'debian'
platform_params[:python_memcache_package_name] = 'python3-memcache'
else
platform_params[:python_memcache_package_name] = 'python-memcache'
end
platform_params[:python_memcache_package_name] = 'python3-memcache'
when 'RedHat'
platform_params[:python_memcache_package_name] = 'python-memcached'
end

33
spec/defines/oslo_db_spec.rb

@ -83,9 +83,9 @@ describe 'oslo::db' do
end
it 'install the proper backend package' do
is_expected.to contain_package('python-pymongo').with(
is_expected.to contain_package(platform_params[:pymongo_package_name]).with(
:ensure => 'present',
:name => 'python-pymongo',
:name => platform_params[:pymongo_package_name],
:tag => 'openstack'
)
end
@ -175,9 +175,9 @@ describe 'oslo::db' do
end
it 'install the proper backend package' do
is_expected.to contain_package('python-pymysql').with(
is_expected.to contain_package(platform_params[:pymysql_package_name]).with(
:ensure => 'present',
:name => 'python-pymysql',
:name => platform_params[:pymysql_package_name],
:tag => 'openstack'
)
end
@ -201,9 +201,9 @@ describe 'oslo::db' do
end
it 'install the proper backend package' do
is_expected.to contain_package('python-pysqlite2').with(
is_expected.to contain_package(platform_params[:pysqlite2_package_name]).with(
:ensure => 'present',
:name => 'python-pysqlite2',
:name => platform_params[:pysqlite2_package_name],
:tag => 'openstack'
)
end
@ -238,8 +238,25 @@ describe 'oslo::db' do
facts.merge!(OSDefaults.get_facts())
end
it_behaves_like 'oslo-db'
it_behaves_like "oslo-db on #{facts[:osfamily]}"
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:pymongo_package_name => 'python3-pymongo',
:pymysql_package_name => 'python3-pymysql',
:pysqlite2_package_name => 'python3-pysqlite2',
}
when 'RedHat'
{
:pymongo_package_name => 'python-pymongo',
:pymysql_package_name => nil,
:pysqlite2_package_name => nil,
}
end
end
it_behaves_like 'oslo-db'
it_behaves_like "oslo-db on #{facts[:osfamily]}"
end
end
end

Loading…
Cancel
Save