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
|
include openstacklib::openstackclient
|
||||||
|
|
||||||
if $install_from_source {
|
if $install_from_source {
|
||||||
$setuptools_pkg = 'python3-setuptools'
|
ensure_packages(['git'])
|
||||||
ensure_packages([
|
|
||||||
'git',
|
|
||||||
$setuptools_pkg,
|
|
||||||
])
|
|
||||||
|
|
||||||
ensure_packages($tempest::params::dev_packages)
|
ensure_packages($tempest::params::dev_packages)
|
||||||
|
|
||||||
# NOTE(aschultz): Ubuntu setup tools has dropped easy_install since 18.04
|
if $::tempest::params::pip_package_name {
|
||||||
# so we install via package now. Though if we hit this, we can only
|
ensure_packages('pip', {
|
||||||
# install "pip". This likely should just be removed though I'm not sure
|
name => $::tempest::params::pip_package_name,
|
||||||
# about pip availability for RHEL systems.
|
})
|
||||||
exec { 'install-pip':
|
Package['pip'] -> Exec['install-tox']
|
||||||
command => 'easy_install pip',
|
} else {
|
||||||
unless => "which ${tempest::params::pip_command}",
|
warning('pip package is not available in this distribution.')
|
||||||
path => ['/bin','/usr/bin','/usr/local/bin'],
|
|
||||||
require => Package[$setuptools_pkg],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exec { 'install-tox':
|
exec { 'install-tox':
|
||||||
command => "${tempest::params::pip_command} install -U tox",
|
command => "${tempest::params::pip_command} install -U tox",
|
||||||
unless => 'which tox',
|
unless => 'which tox',
|
||||||
path => ['/bin','/usr/bin','/usr/local/bin'],
|
path => ['/bin','/usr/bin','/usr/local/bin'],
|
||||||
require => Exec['install-pip'],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if $git_clone {
|
if $git_clone {
|
||||||
|
@ -36,6 +36,10 @@ class tempest::params {
|
|||||||
$python_barbican_tests = 'python3-barbican-tests-tempest'
|
$python_barbican_tests = 'python3-barbican-tests-tempest'
|
||||||
$python_manila_tests = 'python3-manila-tests-tempest'
|
$python_manila_tests = 'python3-manila-tests-tempest'
|
||||||
$package_name = 'openstack-tempest'
|
$package_name = 'openstack-tempest'
|
||||||
|
$pip_package_name = $facts['os']['name'] ? {
|
||||||
|
'RedHat' => undef,
|
||||||
|
default => 'python3-pip'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$dev_packages = [
|
$dev_packages = [
|
||||||
@ -47,7 +51,6 @@ class tempest::params {
|
|||||||
'patch',
|
'patch',
|
||||||
'gcc',
|
'gcc',
|
||||||
'python3-virtualenv',
|
'python3-virtualenv',
|
||||||
'python3-pip',
|
|
||||||
]
|
]
|
||||||
if $facts['os']['name'] == 'Debian' {
|
if $facts['os']['name'] == 'Debian' {
|
||||||
$python_telemetry_tests = 'telemetry-tempest-plugin'
|
$python_telemetry_tests = 'telemetry-tempest-plugin'
|
||||||
@ -96,6 +99,7 @@ class tempest::params {
|
|||||||
$python_manila_tests = false
|
$python_manila_tests = false
|
||||||
$package_name = 'tempest'
|
$package_name = 'tempest'
|
||||||
}
|
}
|
||||||
|
$pip_package_name = 'python3-pip'
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail("Unsupported osfamily: ${facts['os']['family']}")
|
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
|
it 'installs packages' do
|
||||||
|
|
||||||
is_expected.to contain_package('git')
|
is_expected.to contain_package('git')
|
||||||
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}")
|
||||||
@ -212,18 +211,16 @@ describe 'tempest' do
|
|||||||
|
|
||||||
is_expected.to contain_class('tempest::params')
|
is_expected.to contain_class('tempest::params')
|
||||||
|
|
||||||
is_expected.to contain_exec('install-pip').with(
|
if platform_params[:pip_package_name]
|
||||||
:command => 'easy_install pip',
|
is_expected.to contain_package('pip').with(
|
||||||
:unless => "which #{platform_params[:pip_command]}",
|
:name => platform_params[:pip_package_name],
|
||||||
:path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
)
|
||||||
:require => "Package[python3-setuptools]"
|
end
|
||||||
)
|
|
||||||
|
|
||||||
is_expected.to contain_exec('install-tox').with(
|
is_expected.to contain_exec('install-tox').with(
|
||||||
:command => "#{platform_params[:pip_command]} install -U tox",
|
:command => "#{platform_params[:pip_command]} install -U tox",
|
||||||
:unless => 'which tox',
|
:unless => 'which tox',
|
||||||
:path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
:path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
||||||
:require => 'Exec[install-pip]'
|
|
||||||
)
|
)
|
||||||
|
|
||||||
is_expected.to contain_vcsrepo('/var/lib/tempest').with(
|
is_expected.to contain_vcsrepo('/var/lib/tempest').with(
|
||||||
@ -592,10 +589,10 @@ describe 'tempest' do
|
|||||||
'libffi-dev',
|
'libffi-dev',
|
||||||
'patch',
|
'patch',
|
||||||
'gcc',
|
'gcc',
|
||||||
'python3-virtualenv',
|
'python3-virtualenv'],
|
||||||
'python3-pip' ],
|
|
||||||
:package_name => 'tempest',
|
:package_name => 'tempest',
|
||||||
:pip_command => 'pip3',
|
:pip_command => 'pip3',
|
||||||
|
:pip_package_name => 'python3-pip',
|
||||||
:python_keystone_tests => 'keystone-tempest-plugin',
|
:python_keystone_tests => 'keystone-tempest-plugin',
|
||||||
:python_neutron_tests => 'neutron-tempest-plugin',
|
:python_neutron_tests => 'neutron-tempest-plugin',
|
||||||
:python_sahara_tests => false }
|
:python_sahara_tests => false }
|
||||||
@ -609,6 +606,7 @@ describe 'tempest' do
|
|||||||
'gcc'],
|
'gcc'],
|
||||||
:package_name => 'openstack-tempest',
|
:package_name => 'openstack-tempest',
|
||||||
:pip_command => 'pip3',
|
:pip_command => 'pip3',
|
||||||
|
:pip_package_name => 'python3-pip',
|
||||||
:python_keystone_tests => 'python3-keystone-tests-tempest',
|
:python_keystone_tests => 'python3-keystone-tests-tempest',
|
||||||
:python_neutron_tests => 'python3-neutron-tests-tempest',
|
:python_neutron_tests => 'python3-neutron-tests-tempest',
|
||||||
:python_sahara_tests => 'python3-sahara-tests-tempest' }
|
:python_sahara_tests => 'python3-sahara-tests-tempest' }
|
||||||
|
Loading…
Reference in New Issue
Block a user