From 0f9ce49e1109ccfd81a430d7c9b3943eba393a55 Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Fri, 21 May 2021 14:18:49 +0200 Subject: [PATCH] Get rid of the $pyvers variable Since everyone has switched to Python3, it's time for the removal of the $pyvers variable. Change-Id: I4d5cc551d062aaf53b7d07c03baae33385707cea --- manifests/init.pp | 4 +-- manifests/params.pp | 59 +++++++++++++++---------------- spec/classes/tempest_init_spec.rb | 54 +++++++--------------------- 3 files changed, 44 insertions(+), 73 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 741b0331..a1c8722c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -433,7 +433,7 @@ class tempest( include openstacklib::openstackclient if $install_from_source { - $setuptools_pkg = "python${tempest::params::pyvers}-setuptools" + $setuptools_pkg = 'python3-setuptools' ensure_packages([ 'git', $setuptools_pkg, @@ -474,7 +474,7 @@ class tempest( if $setup_venv { # virtualenv will be installed along with tox 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"], ' && '), cwd => $tempest_clone_path, diff --git a/manifests/params.pp b/manifests/params.pp index 828d5d79..406ed709 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,13 +1,12 @@ # class tempest::params { include openstacklib::defaults - $pyvers = $::openstacklib::defaults::pyvers - $pip_command = "pip${pyvers}" + $pip_command = 'pip3' case $::osfamily { 'RedHat': { $dev_packages = [ - "python${pyvers}-devel", + 'python3-devel', 'libxslt-devel', 'libxml2-devel', 'openssl-devel', @@ -15,43 +14,43 @@ class tempest::params { 'patch', 'gcc' ] - $python_telemetry_tests = "python${pyvers}-telemetry-tests-tempest" - $python_cinder_tests = "python${pyvers}-cinder-tests-tempest" - $python_designate_tests = "python${pyvers}-designate-tests-tempest" - $python_glance_tests = "python${pyvers}-glance-tests" - $python_heat_tests = "python${pyvers}-heat-tests-tempest" - $python_ironic_tests = "python${pyvers}-ironic-tests-tempest" - $python_keystone_tests = "python${pyvers}-keystone-tests" - $python_magnum_tests = "python${pyvers}-magnum-tests-tempest" - $python_mistral_tests = "python${pyvers}-mistral-tests-tempest" - $python_vitrage_tests = "python${pyvers}-vitrage-tests-tempest" - $python_murano_tests = "python${pyvers}-murano-tests-tempest" - $python_neutron_tests = "python${pyvers}-neutron-tests-tempest" - $python_l2gw_tests = "python${pyvers}-networking-l2gw-tests-tempest" - $python_vpnaas_tests = "python${pyvers}-neutron-vpnaas-tests" - $python_dr_tests = "python${pyvers}-neutron-dynamic-routing-tests" - $python_nova_tests = "python${pyvers}-nova-tests" - $python_sahara_tests = "python${pyvers}-sahara-tests-tempest" - $python_swift_tests = "python${pyvers}-swift-tests" - $python_trove_tests = "python${pyvers}-trove-tests-tempest" - $python_watcher_tests = "python${pyvers}-watcher-tests-tempest" - $python_zaqar_tests = "python${pyvers}-zaqar-tests-tempest" - $python_octavia_tests = "python${pyvers}-octavia-tests-tempest" - $python_ec2api_tests = "python${pyvers}-ec2api-tests-tempest" - $python_barbican_tests = "python${pyvers}-barbican-tests-tempest" + $python_telemetry_tests = 'python3-telemetry-tests-tempest' + $python_cinder_tests = 'python3-cinder-tests-tempest' + $python_designate_tests = 'python3-designate-tests-tempest' + $python_glance_tests = 'python3-glance-tests' + $python_heat_tests = 'python3-heat-tests-tempest' + $python_ironic_tests = 'python3-ironic-tests-tempest' + $python_keystone_tests = 'python3-keystone-tests' + $python_magnum_tests = 'python3-magnum-tests-tempest' + $python_mistral_tests = 'python3-mistral-tests-tempest' + $python_vitrage_tests = 'python3-vitrage-tests-tempest' + $python_murano_tests = 'python3-murano-tests-tempest' + $python_neutron_tests = 'python3-neutron-tests-tempest' + $python_l2gw_tests = 'python3-networking-l2gw-tests-tempest' + $python_vpnaas_tests = 'python3-neutron-vpnaas-tests' + $python_dr_tests = 'python3-neutron-dynamic-routing-tests' + $python_nova_tests = 'python3-nova-tests' + $python_sahara_tests = 'python3-sahara-tests-tempest' + $python_swift_tests = 'python3-swift-tests' + $python_trove_tests = 'python3-trove-tests-tempest' + $python_watcher_tests = 'python3-watcher-tests-tempest' + $python_zaqar_tests = 'python3-zaqar-tests-tempest' + $python_octavia_tests = 'python3-octavia-tests-tempest' + $python_ec2api_tests = 'python3-ec2api-tests-tempest' + $python_barbican_tests = 'python3-barbican-tests-tempest' $package_name = 'openstack-tempest' } 'Debian': { $dev_packages = [ - "python${pyvers}-dev", + 'python3-dev', 'libxslt1-dev', 'libxml2-dev', 'libssl-dev', 'libffi-dev', 'patch', 'gcc', - "python${pyvers}-virtualenv", - "python${pyvers}-pip", + 'python3-virtualenv', + 'python3-pip', ] if $::os_package_type == 'debian' { $python_telemetry_tests = 'telemetry-tempest-plugin' diff --git a/spec/classes/tempest_init_spec.rb b/spec/classes/tempest_init_spec.rb index 093b847e..7d17c2c4 100644 --- a/spec/classes/tempest_init_spec.rb +++ b/spec/classes/tempest_init_spec.rb @@ -160,7 +160,7 @@ describe 'tempest' do it 'installs packages' do 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| is_expected.to contain_package("#{package}") @@ -172,7 +172,7 @@ describe 'tempest' do :command => 'easy_install pip', :unless => "which #{platform_params[:pip_command]}", :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( @@ -305,7 +305,7 @@ describe 'tempest' do it 'sets up virtualenv for tempest' do 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', :unless => 'test -d /var/lib/tempest/.venv', :path => ['/bin', '/usr/bin', '/usr/local/bin'] @@ -467,45 +467,17 @@ describe 'tempest' do 'python3-virtualenv', 'python3-pip' ], :package_name => 'tempest', - :pip_command => 'pip3', - :pyvers => '3' } + :pip_command => 'pip3' } when 'RedHat' - if facts[:operatingsystem] == 'Fedora' - { :dev_packages => ['python-devel', - 'libxslt-devel', - 'libxml2-devel', - 'openssl-devel', - 'libffi-devel', - 'patch', - 'gcc'], - :package_name => 'openstack-tempest', - :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 + { :dev_packages => ['python3-devel', + 'libxslt-devel', + 'libxml2-devel', + 'openssl-devel', + 'libffi-devel', + 'patch', + 'gcc'], + :package_name => 'openstack-tempest', + :pip_command => 'pip3' } end end