Merge "Get rid of the $pyvers variable"

This commit is contained in:
Zuul 2021-06-10 19:03:45 +00:00 committed by Gerrit Code Review
commit 61a5127cc9
3 changed files with 44 additions and 73 deletions

View File

@ -437,7 +437,7 @@ class tempest(
include openstacklib::openstackclient include openstacklib::openstackclient
if $install_from_source { if $install_from_source {
$setuptools_pkg = "python${tempest::params::pyvers}-setuptools" $setuptools_pkg = 'python3-setuptools'
ensure_packages([ ensure_packages([
'git', 'git',
$setuptools_pkg, $setuptools_pkg,
@ -478,7 +478,7 @@ class tempest(
if $setup_venv { if $setup_venv {
# virtualenv will be installed along with tox # virtualenv will be installed along with tox
exec { 'setup-venv': exec { 'setup-venv':
command => join(["virtualenv -p python${tempest::params::pyvers} ${tempest_clone_path}/.venv", command => join(["virtualenv -p python3 ${tempest_clone_path}/.venv",
"${tempest_clone_path}/.venv/bin/${tempest::params::pip_command} install -U -r requirements.txt"], "${tempest_clone_path}/.venv/bin/${tempest::params::pip_command} install -U -r requirements.txt"],
' && '), ' && '),
cwd => $tempest_clone_path, cwd => $tempest_clone_path,

View File

@ -1,13 +1,12 @@
# #
class tempest::params { class tempest::params {
include openstacklib::defaults include openstacklib::defaults
$pyvers = $::openstacklib::defaults::pyvers
$pip_command = "pip${pyvers}" $pip_command = 'pip3'
case $::osfamily { case $::osfamily {
'RedHat': { 'RedHat': {
$dev_packages = [ $dev_packages = [
"python${pyvers}-devel", 'python3-devel',
'libxslt-devel', 'libxslt-devel',
'libxml2-devel', 'libxml2-devel',
'openssl-devel', 'openssl-devel',
@ -15,43 +14,43 @@ class tempest::params {
'patch', 'patch',
'gcc' 'gcc'
] ]
$python_telemetry_tests = "python${pyvers}-telemetry-tests-tempest" $python_telemetry_tests = 'python3-telemetry-tests-tempest'
$python_cinder_tests = "python${pyvers}-cinder-tests-tempest" $python_cinder_tests = 'python3-cinder-tests-tempest'
$python_designate_tests = "python${pyvers}-designate-tests-tempest" $python_designate_tests = 'python3-designate-tests-tempest'
$python_glance_tests = "python${pyvers}-glance-tests" $python_glance_tests = 'python3-glance-tests'
$python_heat_tests = "python${pyvers}-heat-tests-tempest" $python_heat_tests = 'python3-heat-tests-tempest'
$python_ironic_tests = "python${pyvers}-ironic-tests-tempest" $python_ironic_tests = 'python3-ironic-tests-tempest'
$python_keystone_tests = "python${pyvers}-keystone-tests" $python_keystone_tests = 'python3-keystone-tests'
$python_magnum_tests = "python${pyvers}-magnum-tests-tempest" $python_magnum_tests = 'python3-magnum-tests-tempest'
$python_mistral_tests = "python${pyvers}-mistral-tests-tempest" $python_mistral_tests = 'python3-mistral-tests-tempest'
$python_vitrage_tests = "python${pyvers}-vitrage-tests-tempest" $python_vitrage_tests = 'python3-vitrage-tests-tempest'
$python_murano_tests = "python${pyvers}-murano-tests-tempest" $python_murano_tests = 'python3-murano-tests-tempest'
$python_neutron_tests = "python${pyvers}-neutron-tests-tempest" $python_neutron_tests = 'python3-neutron-tests-tempest'
$python_l2gw_tests = "python${pyvers}-networking-l2gw-tests-tempest" $python_l2gw_tests = 'python3-networking-l2gw-tests-tempest'
$python_vpnaas_tests = "python${pyvers}-neutron-vpnaas-tests" $python_vpnaas_tests = 'python3-neutron-vpnaas-tests'
$python_dr_tests = "python${pyvers}-neutron-dynamic-routing-tests" $python_dr_tests = 'python3-neutron-dynamic-routing-tests'
$python_nova_tests = "python${pyvers}-nova-tests" $python_nova_tests = 'python3-nova-tests'
$python_sahara_tests = "python${pyvers}-sahara-tests-tempest" $python_sahara_tests = 'python3-sahara-tests-tempest'
$python_swift_tests = "python${pyvers}-swift-tests" $python_swift_tests = 'python3-swift-tests'
$python_trove_tests = "python${pyvers}-trove-tests-tempest" $python_trove_tests = 'python3-trove-tests-tempest'
$python_watcher_tests = "python${pyvers}-watcher-tests-tempest" $python_watcher_tests = 'python3-watcher-tests-tempest'
$python_zaqar_tests = "python${pyvers}-zaqar-tests-tempest" $python_zaqar_tests = 'python3-zaqar-tests-tempest'
$python_octavia_tests = "python${pyvers}-octavia-tests-tempest" $python_octavia_tests = 'python3-octavia-tests-tempest'
$python_ec2api_tests = "python${pyvers}-ec2api-tests-tempest" $python_ec2api_tests = 'python3-ec2api-tests-tempest'
$python_barbican_tests = "python${pyvers}-barbican-tests-tempest" $python_barbican_tests = 'python3-barbican-tests-tempest'
$package_name = 'openstack-tempest' $package_name = 'openstack-tempest'
} }
'Debian': { 'Debian': {
$dev_packages = [ $dev_packages = [
"python${pyvers}-dev", 'python3-dev',
'libxslt1-dev', 'libxslt1-dev',
'libxml2-dev', 'libxml2-dev',
'libssl-dev', 'libssl-dev',
'libffi-dev', 'libffi-dev',
'patch', 'patch',
'gcc', 'gcc',
"python${pyvers}-virtualenv", 'python3-virtualenv',
"python${pyvers}-pip", 'python3-pip',
] ]
if $::os_package_type == 'debian' { if $::os_package_type == 'debian' {
$python_telemetry_tests = 'telemetry-tempest-plugin' $python_telemetry_tests = 'telemetry-tempest-plugin'

View File

@ -160,7 +160,7 @@ describe 'tempest' do
it 'installs packages' do it 'installs packages' do
is_expected.to contain_package('git') is_expected.to contain_package('git')
is_expected.to contain_package("python#{platform_params[:pyvers]}-setuptools") is_expected.to contain_package("python3-setuptools")
platform_params[:dev_packages].each do |package| platform_params[:dev_packages].each do |package|
is_expected.to contain_package("#{package}") is_expected.to contain_package("#{package}")
@ -172,7 +172,7 @@ describe 'tempest' do
:command => 'easy_install pip', :command => 'easy_install pip',
:unless => "which #{platform_params[:pip_command]}", :unless => "which #{platform_params[:pip_command]}",
:path => ['/bin', '/usr/bin', '/usr/local/bin'], :path => ['/bin', '/usr/bin', '/usr/local/bin'],
:require => "Package[python#{platform_params[:pyvers]}-setuptools]" :require => "Package[python3-setuptools]"
) )
is_expected.to contain_exec('install-tox').with( is_expected.to contain_exec('install-tox').with(
@ -304,7 +304,7 @@ describe 'tempest' do
it 'sets up virtualenv for tempest' do it 'sets up virtualenv for tempest' do
is_expected.to contain_exec('setup-venv').with( is_expected.to contain_exec('setup-venv').with(
:command => "virtualenv -p python#{platform_params[:pyvers]} /var/lib/tempest/.venv && /var/lib/tempest/.venv/bin/#{platform_params[:pip_command]} install -U -r requirements.txt", :command => "virtualenv -p python3 /var/lib/tempest/.venv && /var/lib/tempest/.venv/bin/#{platform_params[:pip_command]} install -U -r requirements.txt",
:cwd => '/var/lib/tempest', :cwd => '/var/lib/tempest',
:unless => 'test -d /var/lib/tempest/.venv', :unless => 'test -d /var/lib/tempest/.venv',
:path => ['/bin', '/usr/bin', '/usr/local/bin'] :path => ['/bin', '/usr/bin', '/usr/local/bin']
@ -466,45 +466,17 @@ describe 'tempest' do
'python3-virtualenv', 'python3-virtualenv',
'python3-pip' ], 'python3-pip' ],
:package_name => 'tempest', :package_name => 'tempest',
:pip_command => 'pip3', :pip_command => 'pip3' }
:pyvers => '3' }
when 'RedHat' when 'RedHat'
if facts[:operatingsystem] == 'Fedora' { :dev_packages => ['python3-devel',
{ :dev_packages => ['python-devel', 'libxslt-devel',
'libxslt-devel', 'libxml2-devel',
'libxml2-devel', 'openssl-devel',
'openssl-devel', 'libffi-devel',
'libffi-devel', 'patch',
'patch', 'gcc'],
'gcc'], :package_name => 'openstack-tempest',
:package_name => 'openstack-tempest', :pip_command => 'pip3' }
:pip_command => 'pip3',
:pyvers => '3' }
else
if facts[:operatingsystemmajrelease] > '7'
{ :dev_packages => ['python3-devel',
'libxslt-devel',
'libxml2-devel',
'openssl-devel',
'libffi-devel',
'patch',
'gcc'],
:package_name => 'openstack-tempest',
:pip_command => 'pip3',
:pyvers => '3' }
else
{ :dev_packages => ['python-devel',
'libxslt-devel',
'libxml2-devel',
'openssl-devel',
'libffi-devel',
'patch',
'gcc'],
:package_name => 'openstack-tempest',
:pip_command => 'pip',
:pyvers => '' }
end
end
end end
end end