Install openstackclient into virtualenv

There may be issues caused by updated OpenStack python libraries being
picked up by other services when we install python-openstackclient
globally. So instead install it into its own virtualenv and create a
symlink to the resulting binary.

Change-Id: I43d9baf13dda20d39d3c52faf1f2322eee4884a3
Partial-Bug: 1661708
This commit is contained in:
Jens Rosenboom 2017-02-08 14:37:04 +00:00
parent b6f06c34af
commit 3d06aeabbf
2 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,7 @@
# Recipe:: client
#
# Copyright 2014, IBM Corp.
# Copyright 2017, cloudbau GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -20,6 +21,15 @@
python_runtime '2'
python_virtualenv '/opt/osc' do
system_site_packages true
end
python_package 'python-openstackclient' do
version node['openstack']['common']['client_version']
virtualenv '/opt/osc'
end
link '/usr/local/bin/openstack' do
to '/opt/osc/bin/openstack'
end

View File

@ -13,9 +13,19 @@ describe 'openstack-common::client' do
expect(chef_run).to install_python_runtime('2')
end
it do
expect(chef_run).to create_python_virtualenv('/opt/osc')
.with(system_site_packages: true)
end
it do
expect(chef_run).to install_python_package('python-openstackclient')
.with(version: '3.6.0')
end
it do
expect(chef_run).to create_link('/usr/local/bin/openstack')
.with(to: '/opt/osc/bin/openstack')
end
end
end