From 83a9525fd03266f75da3317cef24ac3c68e90a8b Mon Sep 17 00:00:00 2001 From: Jan Klare Date: Fri, 5 Aug 2016 11:52:11 +0200 Subject: [PATCH] install python-openstackclient from pip and not from package * the packaged version of python-openstackclient for ubuntu and centos are quite old and we need the new version to completely switch all cookbook logic to the openstackclient * this patch include the poise-python cookbook and uses its resources to install a python 2 environment and the python-openstackclient Change-Id: I881075dcd11d06d9c1537d929c7626155c01a1d6 --- attributes/default.rb | 2 -- metadata.rb | 1 + recipes/client.rb | 9 +++------ spec/client-redhat_spec.rb | 16 ---------------- spec/client_spec.rb | 9 +++++++-- 5 files changed, 11 insertions(+), 26 deletions(-) delete mode 100644 spec/client-redhat_spec.rb diff --git a/attributes/default.rb b/attributes/default.rb index 8738d71b..6cdb156d 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -286,12 +286,10 @@ default['openstack']['sysctl']['net.ipv4.conf.default.rp_filter'] = 0 case node['platform_family'] when 'rhel' default['openstack']['common']['platform'] = { - 'common_client_packages' => ['python-openstackclient'], 'package_overrides' => '' } when 'debian' default['openstack']['common']['platform'] = { - 'common_client_packages' => ['python-openstackclient'], 'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'" } end diff --git a/metadata.rb b/metadata.rb index da95b735..e8fa56b5 100644 --- a/metadata.rb +++ b/metadata.rb @@ -23,3 +23,4 @@ depends 'mysql', '~> 6.0.13' depends 'yum', '~> 3.5.4' depends 'yum-epel', '~> 0.6.0' depends 'galera', '~> 0.4.1' +depends 'poise-python', '~> 1.4.0' diff --git a/recipes/client.rb b/recipes/client.rb index a6c07294..6df4ace7 100644 --- a/recipes/client.rb +++ b/recipes/client.rb @@ -18,11 +18,8 @@ # limitations under the License. # -platform_options = node['openstack']['common']['platform'] -platform_options['common_client_packages'].each do |pkg| - package pkg do - options platform_options['package_overrides'] +python_runtime '2' - action :upgrade - end +python_package 'python-openstackclient' do + version '2.6' end diff --git a/spec/client-redhat_spec.rb b/spec/client-redhat_spec.rb deleted file mode 100644 index 7cfbeb0f..00000000 --- a/spec/client-redhat_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -# encoding: UTF-8 -require_relative 'spec_helper' - -describe 'openstack-common::client' do - describe 'redhat' do - let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) } - let(:node) { runner.node } - let(:chef_run) do - runner.converge(described_recipe) - end - - it 'upgrades common client packages' do - expect(chef_run).to upgrade_package('python-openstackclient') - end - end -end diff --git a/spec/client_spec.rb b/spec/client_spec.rb index c6af88fc..8f28c6dd 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -9,8 +9,13 @@ describe 'openstack-common::client' do runner.converge(described_recipe) end - it 'upgrades common client packages' do - expect(chef_run).to upgrade_package('python-openstackclient') + it 'installs the latest python 2' do + expect(chef_run).to install_python_runtime('2') + end + + it 'installs python-openstackclient 2.6' do + expect(chef_run).to install_python_package('python-openstackclient') + .with(version: '2.6') end end end