Use package to install pip
The easy_install command is no longer available in CentOS 9 (and even CentOS 8), and we should use package installation. Because RHEL has no pip package available now, the package installation is skipped with a warning message. Closes-Bug: #2043206 Change-Id: Id70b4610f5e016ae69fc8ef2b81e2176f199fe87
This commit is contained in:
parent
94b24e02d7
commit
e82af602ea
@ -500,30 +500,22 @@ class tempest(
|
||||
include openstacklib::openstackclient
|
||||
|
||||
if $install_from_source {
|
||||
$setuptools_pkg = 'python3-setuptools'
|
||||
ensure_packages([
|
||||
'git',
|
||||
$setuptools_pkg,
|
||||
])
|
||||
|
||||
ensure_packages(['git'])
|
||||
ensure_packages($tempest::params::dev_packages)
|
||||
|
||||
# NOTE(aschultz): Ubuntu setup tools has dropped easy_install since 18.04
|
||||
# so we install via package now. Though if we hit this, we can only
|
||||
# install "pip". This likely should just be removed though I'm not sure
|
||||
# about pip availability for RHEL systems.
|
||||
exec { 'install-pip':
|
||||
command => 'easy_install pip',
|
||||
unless => "which ${tempest::params::pip_command}",
|
||||
path => ['/bin','/usr/bin','/usr/local/bin'],
|
||||
require => Package[$setuptools_pkg],
|
||||
if $::tempest::params::pip_package_name {
|
||||
ensure_packages('pip', {
|
||||
name => $::tempest::params::pip_package_name,
|
||||
})
|
||||
Package['pip'] -> Exec['install-tox']
|
||||
} else {
|
||||
warning('pip package is not available in this distribution.')
|
||||
}
|
||||
|
||||
exec { 'install-tox':
|
||||
command => "${tempest::params::pip_command} install -U tox",
|
||||
unless => 'which tox',
|
||||
path => ['/bin','/usr/bin','/usr/local/bin'],
|
||||
require => Exec['install-pip'],
|
||||
}
|
||||
|
||||
if $git_clone {
|
||||
|
@ -36,6 +36,10 @@ class tempest::params {
|
||||
$python_barbican_tests = 'python3-barbican-tests-tempest'
|
||||
$python_manila_tests = 'python3-manila-tests-tempest'
|
||||
$package_name = 'openstack-tempest'
|
||||
$pip_package_name = $facts['os']['name'] ? {
|
||||
'RedHat' => undef,
|
||||
default => 'python3-pip'
|
||||
}
|
||||
}
|
||||
'Debian': {
|
||||
$dev_packages = [
|
||||
@ -47,7 +51,6 @@ class tempest::params {
|
||||
'patch',
|
||||
'gcc',
|
||||
'python3-virtualenv',
|
||||
'python3-pip',
|
||||
]
|
||||
if $facts['os']['name'] == 'Debian' {
|
||||
$python_telemetry_tests = 'telemetry-tempest-plugin'
|
||||
@ -96,6 +99,7 @@ class tempest::params {
|
||||
$python_manila_tests = false
|
||||
$package_name = 'tempest'
|
||||
}
|
||||
$pip_package_name = 'python3-pip'
|
||||
}
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${facts['os']['family']}")
|
||||
|
8
releasenotes/notes/use-pip-package-15400e8fe8cbb275.yaml
Normal file
8
releasenotes/notes/use-pip-package-15400e8fe8cbb275.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
The ``tempest`` class now installs the pip command using the distribution
|
||||
package instead of the ``easy_install`` command for CentOS, because
|
||||
the command is no longer provided by the setuptool package now. Note that
|
||||
RHEL does not have the pip package so the package installation is skipped.
|
||||
Make sure the pip command is installed before the class is executed.
|
@ -204,7 +204,6 @@ describe 'tempest' do
|
||||
it 'installs packages' do
|
||||
|
||||
is_expected.to contain_package('git')
|
||||
is_expected.to contain_package("python3-setuptools")
|
||||
|
||||
platform_params[:dev_packages].each do |package|
|
||||
is_expected.to contain_package("#{package}")
|
||||
@ -212,18 +211,16 @@ describe 'tempest' do
|
||||
|
||||
is_expected.to contain_class('tempest::params')
|
||||
|
||||
is_expected.to contain_exec('install-pip').with(
|
||||
:command => 'easy_install pip',
|
||||
:unless => "which #{platform_params[:pip_command]}",
|
||||
:path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
||||
:require => "Package[python3-setuptools]"
|
||||
)
|
||||
if platform_params[:pip_package_name]
|
||||
is_expected.to contain_package('pip').with(
|
||||
:name => platform_params[:pip_package_name],
|
||||
)
|
||||
end
|
||||
|
||||
is_expected.to contain_exec('install-tox').with(
|
||||
:command => "#{platform_params[:pip_command]} install -U tox",
|
||||
:unless => 'which tox',
|
||||
:path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
||||
:require => 'Exec[install-pip]'
|
||||
)
|
||||
|
||||
is_expected.to contain_vcsrepo('/var/lib/tempest').with(
|
||||
@ -592,10 +589,10 @@ describe 'tempest' do
|
||||
'libffi-dev',
|
||||
'patch',
|
||||
'gcc',
|
||||
'python3-virtualenv',
|
||||
'python3-pip' ],
|
||||
'python3-virtualenv'],
|
||||
:package_name => 'tempest',
|
||||
:pip_command => 'pip3',
|
||||
:pip_package_name => 'python3-pip',
|
||||
:python_keystone_tests => 'keystone-tempest-plugin',
|
||||
:python_neutron_tests => 'neutron-tempest-plugin',
|
||||
:python_sahara_tests => false }
|
||||
@ -609,6 +606,7 @@ describe 'tempest' do
|
||||
'gcc'],
|
||||
:package_name => 'openstack-tempest',
|
||||
:pip_command => 'pip3',
|
||||
:pip_package_name => 'python3-pip',
|
||||
:python_keystone_tests => 'python3-keystone-tests-tempest',
|
||||
:python_neutron_tests => 'python3-neutron-tests-tempest',
|
||||
:python_sahara_tests => 'python3-sahara-tests-tempest' }
|
||||
|
Loading…
Reference in New Issue
Block a user