Split out <service>_client configurations
This change introduces the independent classes to manage parameters in the <service>_client sections. These classes provides support for endpoint_type and region_name. Change-Id: If0e06e6c1364f45cfa3a42428cd8e043a5a1b369
This commit is contained in:
parent
d94431de6e
commit
8118ce9a4b
36
manifests/cinder_client.pp
Normal file
36
manifests/cinder_client.pp
Normal file
@ -0,0 +1,36 @@
|
||||
# == Class: watcher::cinder_client
|
||||
#
|
||||
# Configure the cinder_client options
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*api_version*]
|
||||
# (Optional) Version of Cinder API to use in cinderclient.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*endpoint_type*]
|
||||
# (Optional) Type of endpoint to use in cinderclient.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*region_name*]
|
||||
# (Optional) Region in Identify service catalog to use for communication
|
||||
# with the OpenStack service.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class watcher::cinder_client (
|
||||
$api_version = $::os_service_default,
|
||||
$endpoint_type = $::os_service_default,
|
||||
$region_name = $::os_service_default,
|
||||
) {
|
||||
|
||||
include watcher::deps
|
||||
include watcher::params
|
||||
|
||||
$api_version_real = pick($::watcher::cinder_client_api_version, $api_version)
|
||||
|
||||
watcher_config {
|
||||
'cinder_client/api_version': value => $api_version_real;
|
||||
'cinder_client/endpoint_type': value => $endpoint_type;
|
||||
'cinder_client/region_name': value => $region_name;
|
||||
}
|
||||
}
|
36
manifests/glance_client.pp
Normal file
36
manifests/glance_client.pp
Normal file
@ -0,0 +1,36 @@
|
||||
# == Class: watcher::glance_client
|
||||
#
|
||||
# Configure the glance_client options
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*api_version*]
|
||||
# (Optional) Version of Glance API to use in glanceclient.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*endpoint_type*]
|
||||
# (Optional) Type of endpoint to use in glanceclient.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*region_name*]
|
||||
# (Optional) Region in Identify service catalog to use for communication
|
||||
# with the OpenStack service.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class watcher::glance_client (
|
||||
$api_version = $::os_service_default,
|
||||
$endpoint_type = $::os_service_default,
|
||||
$region_name = $::os_service_default,
|
||||
) {
|
||||
|
||||
include watcher::deps
|
||||
include watcher::params
|
||||
|
||||
$api_version_real = pick($::watcher::glance_client_api_version, $api_version)
|
||||
|
||||
watcher_config {
|
||||
'glance_client/api_version': value => $api_version_real;
|
||||
'glance_client/endpoint_type': value => $endpoint_type;
|
||||
'glance_client/region_name': value => $region_name;
|
||||
}
|
||||
}
|
@ -8,22 +8,6 @@
|
||||
# (required) Enable SSL on the API server.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*cinder_client_api_version*]
|
||||
# (required) Version of Cinder API to use in cinderclient.
|
||||
# Default is $::os_service_default.
|
||||
#
|
||||
# [*glance_client_api_version*]
|
||||
# (required) Version of Glance API to use in glanceclient.
|
||||
# Default is $::os_service_default.
|
||||
#
|
||||
# [*neutron_client_api_version*]
|
||||
# (required) Version of Neutron API to use in neutronclient.
|
||||
# Default is $::os_service_default.
|
||||
#
|
||||
# [*nova_client_api_version*]
|
||||
# (required) Version of Nova API to use in novaclient.
|
||||
# Default is $::os_service_default
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) Whether the watcher api package will be installed
|
||||
# Defaults to 'present'
|
||||
@ -234,6 +218,22 @@
|
||||
# (required) Version of Ceilometer API to use in ceilometerclient.
|
||||
# Default is undef
|
||||
#
|
||||
# [*cinder_client_api_version*]
|
||||
# (required) Version of Cinder API to use in cinderclient.
|
||||
# Default is $::os_service_default.
|
||||
#
|
||||
# [*glance_client_api_version*]
|
||||
# (required) Version of Glance API to use in glanceclient.
|
||||
# Default is $::os_service_default.
|
||||
#
|
||||
# [*neutron_client_api_version*]
|
||||
# (required) Version of Neutron API to use in neutronclient.
|
||||
# Default is $::os_service_default.
|
||||
#
|
||||
# [*nova_client_api_version*]
|
||||
# (required) Version of Nova API to use in novaclient.
|
||||
# Default is $::os_service_default
|
||||
#
|
||||
# === Authors
|
||||
#
|
||||
# Daniel Pawlik <daniel.pawlik@corp.ovh.com>
|
||||
@ -241,10 +241,6 @@
|
||||
class watcher (
|
||||
$purge_config = false,
|
||||
$use_ssl = false,
|
||||
$cinder_client_api_version = $::os_service_default,
|
||||
$glance_client_api_version = $::os_service_default,
|
||||
$neutron_client_api_version = $::os_service_default,
|
||||
$nova_client_api_version = $::os_service_default,
|
||||
$package_ensure = 'present',
|
||||
$rabbit_login_method = $::os_service_default,
|
||||
$rabbit_retry_interval = $::os_service_default,
|
||||
@ -291,6 +287,10 @@ class watcher (
|
||||
# DEPRECATED PARAMETERS
|
||||
$amqp_allow_insecure_clients = undef,
|
||||
$ceilometer_client_api_version = undef,
|
||||
$cinder_client_api_version = undef,
|
||||
$glance_client_api_version = undef,
|
||||
$neutron_client_api_version = undef,
|
||||
$nova_client_api_version = undef,
|
||||
) {
|
||||
|
||||
include openstacklib::openstackclient
|
||||
@ -309,6 +309,30 @@ will be removed in a future release.')
|
||||
warning('The ceilometer_client_api_version parameter is deprecated and has no effect')
|
||||
}
|
||||
|
||||
if $cinder_client_api_version != undef {
|
||||
warning('The cinder_client_api_version parameter is deprecated. \
|
||||
Use the watcher::cinder_client class instead')
|
||||
include watcher::cinder_client
|
||||
}
|
||||
|
||||
if $glance_client_api_version != undef {
|
||||
warning('The glance_client_api_version parameter is deprecated. \
|
||||
Use the watcher::glance_client class instead')
|
||||
include watcher::glance_client
|
||||
}
|
||||
|
||||
if $neutron_client_api_version != undef {
|
||||
warning('The neutron_client_api_version parameter is deprecated. \
|
||||
Use the watcher::neutron_client class instead')
|
||||
include watcher::neutron_client
|
||||
}
|
||||
|
||||
if $nova_client_api_version != undef {
|
||||
warning('The nova_client_api_version parameter is deprecated. \
|
||||
Use the watcher::nova_client class instead')
|
||||
include watcher::nova_client
|
||||
}
|
||||
|
||||
package { 'watcher':
|
||||
ensure => $package_ensure,
|
||||
name => $::watcher::params::common_package_name,
|
||||
@ -319,13 +343,6 @@ will be removed in a future release.')
|
||||
purge => $purge_config,
|
||||
}
|
||||
|
||||
watcher_config {
|
||||
'cinder_client/api_version': value => $cinder_client_api_version;
|
||||
'glance_client/api_version': value => $glance_client_api_version;
|
||||
'neutron_client/api_version': value => $neutron_client_api_version;
|
||||
'nova_client/api_version': value => $nova_client_api_version;
|
||||
}
|
||||
|
||||
oslo::messaging::rabbit { 'watcher_config':
|
||||
amqp_durable_queues => $amqp_durable_queues,
|
||||
kombu_ssl_version => $kombu_ssl_version,
|
||||
|
36
manifests/neutron_client.pp
Normal file
36
manifests/neutron_client.pp
Normal file
@ -0,0 +1,36 @@
|
||||
# == Class: watcher::neutron_client
|
||||
#
|
||||
# Configure the neutron_client options
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*api_version*]
|
||||
# (Optional) Version of Neutron API to use in neutronclient.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*endpoint_type*]
|
||||
# (Optional) Type of endpoint to use in neutronclient.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*region_name*]
|
||||
# (Optional) Region in Identify service catalog to use for communication
|
||||
# with the OpenStack service.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class watcher::neutron_client (
|
||||
$api_version = $::os_service_default,
|
||||
$endpoint_type = $::os_service_default,
|
||||
$region_name = $::os_service_default,
|
||||
) {
|
||||
|
||||
include watcher::deps
|
||||
include watcher::params
|
||||
|
||||
$api_version_real = pick($::watcher::neutron_client_api_version, $api_version)
|
||||
|
||||
watcher_config {
|
||||
'neutron_client/api_version': value => $api_version_real;
|
||||
'neutron_client/endpoint_type': value => $endpoint_type;
|
||||
'neutron_client/region_name': value => $region_name;
|
||||
}
|
||||
}
|
36
manifests/nova_client.pp
Normal file
36
manifests/nova_client.pp
Normal file
@ -0,0 +1,36 @@
|
||||
# == Class: watcher::nova_client
|
||||
#
|
||||
# Configure the nova_client options
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*api_version*]
|
||||
# (Optional) Version of Nova API to use in novaclient.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*endpoint_type*]
|
||||
# (Optional) Type of endpoint to use in novaclient.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*region_name*]
|
||||
# (Optional) Region in Identify service catalog to use for communication
|
||||
# with the OpenStack service.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class watcher::nova_client (
|
||||
$api_version = $::os_service_default,
|
||||
$endpoint_type = $::os_service_default,
|
||||
$region_name = $::os_service_default,
|
||||
) {
|
||||
|
||||
include watcher::deps
|
||||
include watcher::params
|
||||
|
||||
$api_version_real = pick($::watcher::nova_client_api_version, $api_version)
|
||||
|
||||
watcher_config {
|
||||
'nova_client/api_version': value => $api_version_real;
|
||||
'nova_client/endpoint_type': value => $endpoint_type;
|
||||
'nova_client/region_name': value => $region_name;
|
||||
}
|
||||
}
|
14
releasenotes/notes/client-classes-e167f5676c4888d1.yaml
Normal file
14
releasenotes/notes/client-classes-e167f5676c4888d1.yaml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The following new class have been added.
|
||||
|
||||
- ``watcher::cinder_client``
|
||||
- ``watcher::glance_client``
|
||||
- ``watcher::neutron_client``
|
||||
- ``watcher::nova_client``
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The ``watcher::<service>_client_api_version`` parameters have been
|
||||
deprecated in favor of the new ``watcher::<service>_client`` classes.
|
46
spec/classes/watcher_cinder_client_spec.rb
Normal file
46
spec/classes/watcher_cinder_client_spec.rb
Normal file
@ -0,0 +1,46 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'watcher::cinder_client' do
|
||||
|
||||
shared_examples 'watcher::cinder_client' do
|
||||
context 'with defaults' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it 'should set the defaults' do
|
||||
should contain_watcher_config('cinder_client/api_version').with_value('<SERVICE DEFAULT>')
|
||||
should contain_watcher_config('cinder_client/endpoint_type').with_value('<SERVICE DEFAULT>')
|
||||
should contain_watcher_config('cinder_client/region_name').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters overridden' do
|
||||
let :params do
|
||||
{
|
||||
:api_version => 3,
|
||||
:endpoint_type => 'publicURL',
|
||||
:region_name => 'regionOne'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should set the defaults' do
|
||||
should contain_watcher_config('cinder_client/api_version').with_value(3)
|
||||
should contain_watcher_config('cinder_client/endpoint_type').with_value('publicURL')
|
||||
should contain_watcher_config('cinder_client/region_name').with_value('regionOne')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
it_behaves_like 'watcher::cinder_client'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
46
spec/classes/watcher_glance_client_spec.rb
Normal file
46
spec/classes/watcher_glance_client_spec.rb
Normal file
@ -0,0 +1,46 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'watcher::glance_client' do
|
||||
|
||||
shared_examples 'watcher::glance_client' do
|
||||
context 'with defaults' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it 'should set the defaults' do
|
||||
should contain_watcher_config('glance_client/api_version').with_value('<SERVICE DEFAULT>')
|
||||
should contain_watcher_config('glance_client/endpoint_type').with_value('<SERVICE DEFAULT>')
|
||||
should contain_watcher_config('glance_client/region_name').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters overridden' do
|
||||
let :params do
|
||||
{
|
||||
:api_version => 2,
|
||||
:endpoint_type => 'publicURL',
|
||||
:region_name => 'regionOne'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should set the defaults' do
|
||||
should contain_watcher_config('glance_client/api_version').with_value(2)
|
||||
should contain_watcher_config('glance_client/endpoint_type').with_value('publicURL')
|
||||
should contain_watcher_config('glance_client/region_name').with_value('regionOne')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
it_behaves_like 'watcher::glance_client'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
46
spec/classes/watcher_neutron_client_spec.rb
Normal file
46
spec/classes/watcher_neutron_client_spec.rb
Normal file
@ -0,0 +1,46 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'watcher::neutron_client' do
|
||||
|
||||
shared_examples 'watcher::neutron_client' do
|
||||
context 'with defaults' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it 'should set the defaults' do
|
||||
should contain_watcher_config('neutron_client/api_version').with_value('<SERVICE DEFAULT>')
|
||||
should contain_watcher_config('neutron_client/endpoint_type').with_value('<SERVICE DEFAULT>')
|
||||
should contain_watcher_config('neutron_client/region_name').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters overridden' do
|
||||
let :params do
|
||||
{
|
||||
:api_version => 2.0,
|
||||
:endpoint_type => 'publicURL',
|
||||
:region_name => 'regionOne'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should set the defaults' do
|
||||
should contain_watcher_config('neutron_client/api_version').with_value(2.0)
|
||||
should contain_watcher_config('neutron_client/endpoint_type').with_value('publicURL')
|
||||
should contain_watcher_config('neutron_client/region_name').with_value('regionOne')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
it_behaves_like 'watcher::neutron_client'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
46
spec/classes/watcher_nova_client_spec.rb
Normal file
46
spec/classes/watcher_nova_client_spec.rb
Normal file
@ -0,0 +1,46 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'watcher::nova_client' do
|
||||
|
||||
shared_examples 'watcher::nova_client' do
|
||||
context 'with defaults' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it 'should set the defaults' do
|
||||
should contain_watcher_config('nova_client/api_version').with_value('<SERVICE DEFAULT>')
|
||||
should contain_watcher_config('nova_client/endpoint_type').with_value('<SERVICE DEFAULT>')
|
||||
should contain_watcher_config('nova_client/region_name').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters overridden' do
|
||||
let :params do
|
||||
{
|
||||
:api_version => 2,
|
||||
:endpoint_type => 'publicURL',
|
||||
:region_name => 'regionOne'
|
||||
}
|
||||
end
|
||||
|
||||
it 'should set the defaults' do
|
||||
should contain_watcher_config('nova_client/api_version').with_value(2)
|
||||
should contain_watcher_config('nova_client/endpoint_type').with_value('publicURL')
|
||||
should contain_watcher_config('nova_client/region_name').with_value('regionOne')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
it_behaves_like 'watcher::nova_client'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user