Add python3 support for source install
Previously the installing of tempest via source (pip/tox/etc) assumed python2. With newer versions we are switching to python3 so we need to use the python3 version of tooling. Additionally easy_install has been removed from python3-setuptools on Ubuntu 18.04 so we need to install pip via the package instead of trying to install pip via source. Change-Id: I6dc78a509a92de77d0b6d0808a6789cddd832c13
This commit is contained in:
parent
49fa8a3e67
commit
8a3069820b
|
@ -415,22 +415,27 @@ class tempest(
|
|||
include ::openstacklib::openstackclient
|
||||
|
||||
if $install_from_source {
|
||||
$setuptools_pkg = "python${tempest::params::pyvers}-setuptools"
|
||||
ensure_packages([
|
||||
'git',
|
||||
'python-setuptools',
|
||||
$setuptools_pkg,
|
||||
], { allow_virtual => true })
|
||||
|
||||
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 pip',
|
||||
unless => "which ${tempest::params::pip_command}",
|
||||
path => ['/bin','/usr/bin','/usr/local/bin'],
|
||||
require => Package['python-setuptools'],
|
||||
require => Package[$setuptools_pkg],
|
||||
}
|
||||
|
||||
exec { 'install-tox':
|
||||
command => 'pip install -U tox',
|
||||
command => "${tempest::params::pip_command} install -U tox",
|
||||
unless => 'which tox',
|
||||
path => ['/bin','/usr/bin','/usr/local/bin'],
|
||||
require => Exec['install-pip'],
|
||||
|
@ -451,7 +456,9 @@ class tempest(
|
|||
if $setup_venv {
|
||||
# virtualenv will be installed along with tox
|
||||
exec { 'setup-venv':
|
||||
command => "virtualenv ${tempest_clone_path}/.venv && ${tempest_clone_path}/.venv/bin/pip install -U -r requirements.txt",
|
||||
command => join(["virtualenv -p python${tempest::params::pyvers} ${tempest_clone_path}/.venv",
|
||||
"${tempest_clone_path}/.venv/bin/${tempest::params::pip_command} install -U -r requirements.txt"],
|
||||
' && '),
|
||||
cwd => $tempest_clone_path,
|
||||
unless => "test -d ${tempest_clone_path}/.venv",
|
||||
path => ['/bin','/usr/bin','/usr/local/bin'],
|
||||
|
|
|
@ -3,10 +3,11 @@ class tempest::params {
|
|||
include ::openstacklib::defaults
|
||||
$pyvers = $::openstacklib::defaults::pyvers
|
||||
|
||||
$pip_command = "pip${pyvers}"
|
||||
case $::osfamily {
|
||||
'RedHat': {
|
||||
$dev_packages = [
|
||||
'python-devel',
|
||||
"python${pyvers}-devel",
|
||||
'libxslt-devel',
|
||||
'libxml2-devel',
|
||||
'openssl-devel',
|
||||
|
@ -47,14 +48,15 @@ class tempest::params {
|
|||
}
|
||||
'Debian': {
|
||||
$dev_packages = [
|
||||
'python-dev',
|
||||
"python${pyvers}-dev",
|
||||
'libxslt1-dev',
|
||||
'libxml2-dev',
|
||||
'libssl-dev',
|
||||
'libffi-dev',
|
||||
'patch',
|
||||
'gcc',
|
||||
'python-virtualenv',
|
||||
"python${pyvers}-virtualenv",
|
||||
"python${pyvers}-pip",
|
||||
]
|
||||
$python_aodh_tests = false
|
||||
$python_bgpvpn_tests = false
|
||||
|
|
|
@ -160,7 +160,7 @@ describe 'tempest' do
|
|||
it 'installs packages' do
|
||||
|
||||
is_expected.to contain_package('git')
|
||||
is_expected.to contain_package('python-setuptools')
|
||||
is_expected.to contain_package("python#{platform_params[:pyvers]}-setuptools")
|
||||
|
||||
platform_params[:dev_packages].each do |package|
|
||||
is_expected.to contain_package("#{package}")
|
||||
|
@ -170,13 +170,13 @@ describe 'tempest' do
|
|||
|
||||
is_expected.to contain_exec('install-pip').with(
|
||||
:command => 'easy_install pip',
|
||||
:unless => 'which pip',
|
||||
:unless => "which #{platform_params[:pip_command]}",
|
||||
:path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
||||
:require => 'Package[python-setuptools]'
|
||||
:require => "Package[python#{platform_params[:pyvers]}-setuptools]"
|
||||
)
|
||||
|
||||
is_expected.to contain_exec('install-tox').with(
|
||||
:command => 'pip install -U tox',
|
||||
:command => "#{platform_params[:pip_command]} install -U tox",
|
||||
:unless => 'which tox',
|
||||
:path => ['/bin', '/usr/bin', '/usr/local/bin'],
|
||||
:require => 'Exec[install-pip]'
|
||||
|
@ -307,7 +307,7 @@ describe 'tempest' do
|
|||
|
||||
it 'sets up virtualenv for tempest' do
|
||||
is_expected.to contain_exec('setup-venv').with(
|
||||
:command => 'virtualenv /var/lib/tempest/.venv && /var/lib/tempest/.venv/bin/pip install -U -r requirements.txt',
|
||||
: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",
|
||||
:cwd => '/var/lib/tempest',
|
||||
:unless => 'test -d /var/lib/tempest/.venv',
|
||||
:path => ['/bin', '/usr/bin', '/usr/local/bin']
|
||||
|
@ -426,15 +426,18 @@ describe 'tempest' do
|
|||
let(:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'Debian'
|
||||
{ :dev_packages => ['python-dev',
|
||||
{ :dev_packages => ['python3-dev',
|
||||
'libxslt1-dev',
|
||||
'libxml2-dev',
|
||||
'libssl-dev',
|
||||
'libffi-dev',
|
||||
'patch',
|
||||
'gcc',
|
||||
'python-virtualenv' ],
|
||||
:package_name => 'tempest'}
|
||||
'python3-virtualenv',
|
||||
'python3-pip' ],
|
||||
:package_name => 'tempest',
|
||||
:pip_command => 'pip3',
|
||||
:pyvers => '3' }
|
||||
when 'RedHat'
|
||||
{ :dev_packages => ['python-devel',
|
||||
'libxslt-devel',
|
||||
|
@ -443,7 +446,9 @@ describe 'tempest' do
|
|||
'libffi-devel',
|
||||
'patch',
|
||||
'gcc'],
|
||||
:package_name => 'openstack-tempest'}
|
||||
:package_name => 'openstack-tempest',
|
||||
:pip_command => 'pip',
|
||||
:pyvers => '' }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue