Support more <service>_client options

Change-Id: Iab36bc2ab6bb065035dbf4c88dbfabf6f5b4349e
This commit is contained in:
Takashi Kajinami 2021-08-19 21:19:58 +09:00
parent 8118ce9a4b
commit 0f17f75530
9 changed files with 320 additions and 0 deletions

View File

@ -0,0 +1,34 @@
# == Class: watcher::gnocchi_client
#
# Configure the gnocchi_client options
#
# === Parameters
#
# [*api_version*]
# (Optional) Version of Gnocchi API to use in gnocchiclient.
# Defaults to $::os_service_default
#
# [*endpoint_type*]
# (Optional) Type of endpoint to use in gnocchiclient.
# 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::gnocchi_client (
$api_version = $::os_service_default,
$endpoint_type = $::os_service_default,
$region_name = $::os_service_default,
) {
include watcher::deps
include watcher::params
watcher_config {
'gnocchi_client/api_version': value => $api_version;
'gnocchi_client/endpoint_type': value => $endpoint_type;
'gnocchi_client/region_name': value => $region_name;
}
}

View File

@ -0,0 +1,34 @@
# == Class: watcher::ironic_client
#
# Configure the ironic_client options
#
# === Parameters
#
# [*api_version*]
# (Optional) Version of Ironic API to use in ironicclient.
# Defaults to $::os_service_default
#
# [*endpoint_type*]
# (Optional) Type of endpoint to use in ironicclient.
# 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::ironic_client (
$api_version = $::os_service_default,
$endpoint_type = $::os_service_default,
$region_name = $::os_service_default,
) {
include watcher::deps
include watcher::params
watcher_config {
'ironic_client/api_version': value => $api_version;
'ironic_client/endpoint_type': value => $endpoint_type;
'ironic_client/region_name': value => $region_name;
}
}

View File

@ -0,0 +1,28 @@
# == Class: watcher::keystone_client
#
# Configure the keystone_client options
#
# === Parameters
#
# [*endpoint_type*]
# (Optional) Type of endpoint to use in keystoneclient.
# 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::keystone_client (
$endpoint_type = $::os_service_default,
$region_name = $::os_service_default,
) {
include watcher::deps
include watcher::params
watcher_config {
'keystone_client/endpoint_type': value => $endpoint_type;
'keystone_client/region_name': value => $region_name;
}
}

View File

@ -0,0 +1,34 @@
# == Class: watcher::placement_client
#
# Configure the placement_client options
#
# === Parameters
#
# [*api_version*]
# (Optional) Microversion of placement API when using placement service.
# Defaults to $::os_service_default
#
# [*interface*]
# (Optional) Type of endpoint when using placement service.
# 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::placement_client (
$api_version = $::os_service_default,
$interface = $::os_service_default,
$region_name = $::os_service_default,
) {
include watcher::deps
include watcher::params
watcher_config {
'placement_client/api_version': value => $api_version;
'placement_client/interface': value => $interface;
'placement_client/region_name': value => $region_name;
}
}

View File

@ -0,0 +1,9 @@
---
features:
- |
The following new classes have been added.
- ``watcher::gnocchi_client``
- ``watcher::ironic_client``
- ``watcher::keystone_client``
- ``watcher::placement_client``

View File

@ -0,0 +1,46 @@
require 'spec_helper'
describe 'watcher::gnocchi_client' do
shared_examples 'watcher::gnocchi_client' do
context 'with defaults' do
let :params do
{}
end
it 'should set the defaults' do
should contain_watcher_config('gnocchi_client/api_version').with_value('<SERVICE DEFAULT>')
should contain_watcher_config('gnocchi_client/endpoint_type').with_value('<SERVICE DEFAULT>')
should contain_watcher_config('gnocchi_client/region_name').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters overridden' do
let :params do
{
:api_version => 1,
:endpoint_type => 'publicURL',
:region_name => 'regionOne'
}
end
it 'should set the defaults' do
should contain_watcher_config('gnocchi_client/api_version').with_value(1)
should contain_watcher_config('gnocchi_client/endpoint_type').with_value('publicURL')
should contain_watcher_config('gnocchi_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::gnocchi_client'
end
end
end

View File

@ -0,0 +1,46 @@
require 'spec_helper'
describe 'watcher::ironic_client' do
shared_examples 'watcher::ironic_client' do
context 'with defaults' do
let :params do
{}
end
it 'should set the defaults' do
should contain_watcher_config('ironic_client/api_version').with_value('<SERVICE DEFAULT>')
should contain_watcher_config('ironic_client/endpoint_type').with_value('<SERVICE DEFAULT>')
should contain_watcher_config('ironic_client/region_name').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters overridden' do
let :params do
{
:api_version => 1,
:endpoint_type => 'publicURL',
:region_name => 'regionOne'
}
end
it 'should set the defaults' do
should contain_watcher_config('ironic_client/api_version').with_value(1)
should contain_watcher_config('ironic_client/endpoint_type').with_value('publicURL')
should contain_watcher_config('ironic_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::ironic_client'
end
end
end

View File

@ -0,0 +1,43 @@
require 'spec_helper'
describe 'watcher::keystone_client' do
shared_examples 'watcher::keystone_client' do
context 'with defaults' do
let :params do
{}
end
it 'should set the defaults' do
should contain_watcher_config('keystone_client/endpoint_type').with_value('<SERVICE DEFAULT>')
should contain_watcher_config('keystone_client/region_name').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters overridden' do
let :params do
{
:endpoint_type => 'publicURL',
:region_name => 'regionOne'
}
end
it 'should set the defaults' do
should contain_watcher_config('keystone_client/endpoint_type').with_value('publicURL')
should contain_watcher_config('keystone_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::keystone_client'
end
end
end

View File

@ -0,0 +1,46 @@
require 'spec_helper'
describe 'watcher::placement_client' do
shared_examples 'watcher::placement_client' do
context 'with defaults' do
let :params do
{}
end
it 'should set the defaults' do
should contain_watcher_config('placement_client/api_version').with_value('<SERVICE DEFAULT>')
should contain_watcher_config('placement_client/interface').with_value('<SERVICE DEFAULT>')
should contain_watcher_config('placement_client/region_name').with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters overridden' do
let :params do
{
:api_version => 1,
:interface => 'publicURL',
:region_name => 'regionOne'
}
end
it 'should set the defaults' do
should contain_watcher_config('placement_client/api_version').with_value(1)
should contain_watcher_config('placement_client/interface').with_value('publicURL')
should contain_watcher_config('placement_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::placement_client'
end
end
end