Add python-openstackclient package support

Add new client recipe for new common client package.
As more new features are only supported via this new python client, we
need to have a way to deploy it and Common seems like the right place.
There is another blueprint for moving the openrc from Compute to Common
that is related to this.

Change-Id: I8ab56b375b28c979021f3c5bc81e364f1cc65226
Implements: blueprint openstack-client
This commit is contained in:
Mark Vanderwiel 2014-04-07 12:00:08 -05:00
parent cc71ef9419
commit 10bab59e86
7 changed files with 89 additions and 1 deletions

View File

@ -1,6 +1,8 @@
# CHANGELOG for cookbook-openstack-common
This file is used to list changes made in each version of cookbook-openstack-common.
## 9.1.0
* Added python-openstackclient support
## 9.0.2
* Allow address_for family default to be overridden

View File

@ -35,6 +35,11 @@ The attribute is in the `default["openstack"]["compute"]["network"]["service_typ
Recipes
=======
client
----
Install the common python openstack client package
default
----

View File

@ -411,3 +411,16 @@ default['openstack']['ceph']['global'] = {
auth_client_required: 'cephx',
filestore_xattr_use_omap: true
}
case node['platform_family']
when 'rhel', 'suse'
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

View File

@ -4,7 +4,7 @@ maintainer_email 'cookbooks@lists.tfoundry.com'
license 'Apache 2.0'
description 'Common OpenStack attributes, libraries and recipes.'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '9.0.2'
version '9.1.0'
recipe 'openstack-common', 'Installs/Configures common recipes'
recipe 'openstack-common::set_endpoints_by_interface', 'Set endpoints by interface'

32
recipes/client.rb Executable file
View File

@ -0,0 +1,32 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-common
# Recipe:: client
#
# Copyright 2014, IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class ::Chef::Recipe # rubocop:disable Documentation
include ::Openstack
end
platform_options = node['openstack']['common']['platform']
platform_options['common_client_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
end

18
spec/client-redhat_spec.rb Executable file
View File

@ -0,0 +1,18 @@
# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-common::client' do
describe 'redhat' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
runner.converge(described_recipe)
end
it 'installs common client packages' do
expect(chef_run).to upgrade_package('python-openstackclient')
end
end
end

18
spec/client_spec.rb Executable file
View File

@ -0,0 +1,18 @@
# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-common::client' do
describe 'ubuntu' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
runner.converge(described_recipe)
end
it 'installs common client packages' do
expect(chef_run).to upgrade_package('python-openstackclient')
end
end
end