Add support for the [service_types] parameters

Change-Id: Ia81c9c3da067cacf131262a0ad9cfa575ff3c246
This commit is contained in:
Takashi Kajinami 2021-11-09 00:10:06 +09:00
parent d481b0cec1
commit 89923f7eb1
3 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,44 @@
# == Class: ceilometer::agent::polling::service_types
#
# Configure service_types parameters
#
# === Parameters
#
# [*glance*]
# (Optional) glance service type.
# Defaults to $::os_service_default
#
# [*neutron*]
# (Optional) neutron service type.
# Defaults to $::os_service_default
#
# [*nova*]
# (Optional) nova service type.
# Defaults to $::os_service_default
#
# [*swift*]
# (Optional) swift service type.
# Defaults to $::os_service_default
#
# [*cinder*]
# (Optional) cinder service type.
# Defaults to $::os_service_default
#
class ceilometer::agent::polling::service_types (
$glance = $::os_service_default,
$neutron = $::os_service_default,
$nova = $::os_service_default,
$swift = $::os_service_default,
$cinder = $::os_service_default,
) {
include ceilometer::deps
ceilometer_config {
'service_types/glance': value => $glance;
'service_types/neutron': value => $neutron;
'service_types/nova': value => $nova;
'service_types/swift': value => $swift;
'service_types/cinder': value => $cinder;
}
}

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``ceilometer::agent::polling::service_types`` class, to manage
parameters in the ``[service_types]`` section, has been added.

View File

@ -0,0 +1,47 @@
require 'spec_helper'
describe 'ceilometer::agent::polling::service_types' do
shared_examples 'ceilometer::agent::polling::service_types' do
context 'with default parameters' do
it 'configures the default values' do
is_expected.to contain_ceilometer_config('service_types/glance').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('service_types/neutron').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('service_types/nova').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('service_types/swift').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('service_types/cinder').with_value('<SERVICE DEFAULT>')
end
end
context 'with overridden parameters' do
let :params do
{
:glance => 'image',
:neutron => 'network',
:nova => 'compute',
:swift => 'object-store',
:cinder => 'volumev3',
}
end
it 'configures the overridden values' do
is_expected.to contain_ceilometer_config('service_types/glance').with_value('image')
is_expected.to contain_ceilometer_config('service_types/neutron').with_value('network')
is_expected.to contain_ceilometer_config('service_types/nova').with_value('compute')
is_expected.to contain_ceilometer_config('service_types/swift').with_value('object-store')
is_expected.to contain_ceilometer_config('service_types/cinder').with_value('volumev3')
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 'ceilometer::agent::polling::service_types'
end
end
end