Add region_name and interface for gnocchi collector

Change-Id: I0b07655a1ed4b0fd305fa58f338335871db66e3f
This commit is contained in:
Rocky
2021-07-27 15:46:12 +10:00
parent 085e1cbfb9
commit 64badc2d55
3 changed files with 22 additions and 2 deletions

View File

@@ -44,6 +44,14 @@
# (optional) Config Section from which to load plugin specific options # (optional) Config Section from which to load plugin specific options
# Default to 'keystone_authtoken'. # Default to 'keystone_authtoken'.
# #
# [*region_name*]
# (optional) Region name for gnocchi collector
# Default to $::os_service_default
#
# [*interface*]
# (optional) Endpoint URL type
# Default to $::os_service_default
#
class cloudkitty::processor ( class cloudkitty::processor (
$package_ensure = 'present', $package_ensure = 'present',
$manage_service = true, $manage_service = true,
@@ -55,6 +63,8 @@ class cloudkitty::processor (
$services = $::os_service_default, $services = $::os_service_default,
$auth_type = 'password', $auth_type = 'password',
$auth_section = 'keystone_authtoken', $auth_section = 'keystone_authtoken',
$region_name = $::os_service_default,
$interface = $::os_service_default,
) { ) {
include cloudkitty::deps include cloudkitty::deps
@@ -98,7 +108,9 @@ class cloudkitty::processor (
cloudkitty_config { cloudkitty_config {
'collect/collector': value => $collector; 'collect/collector': value => $collector;
'collector_gnocchi/auth_type': value => $auth_type; 'collector_gnocchi/auth_type': value => $auth_type;
'collector_gnocchi/auth_section': value => $auth_section 'collector_gnocchi/auth_section': value => $auth_section;
'collector_gnocchi/region_name': value => $region_name;
'collector_gnocchi/interface': value => $interface;
} }
} }

View File

@@ -0,0 +1,4 @@
---
features:
- |
Add parameters region_name and interface for gnocchi collector.

View File

@@ -8,7 +8,9 @@ describe 'cloudkitty::processor' do
:collector => 'gnocchi', :collector => 'gnocchi',
:period => '60', :period => '60',
:wait_periods => '1', :wait_periods => '1',
:window => '3600',} :window => '3600',
:region_name => 'RegionOne',
:interface => 'publicURL',}
end end
shared_examples_for 'cloudkitty-processor' do shared_examples_for 'cloudkitty-processor' do
@@ -23,6 +25,8 @@ describe 'cloudkitty::processor' do
it { is_expected.to contain_cloudkitty_config('collect/wait_periods').with_value( params[:wait_periods] ) } it { is_expected.to contain_cloudkitty_config('collect/wait_periods').with_value( params[:wait_periods] ) }
it { is_expected.to contain_cloudkitty_config('collector_gnocchi/auth_type').with_value('password') } it { is_expected.to contain_cloudkitty_config('collector_gnocchi/auth_type').with_value('password') }
it { is_expected.to contain_cloudkitty_config('collector_gnocchi/auth_section').with_value('keystone_authtoken') } it { is_expected.to contain_cloudkitty_config('collector_gnocchi/auth_section').with_value('keystone_authtoken') }
it { is_expected.to contain_cloudkitty_config('collector_gnocchi/region_name').with_value( params[:region_name] ) }
it { is_expected.to contain_cloudkitty_config('collector_gnocchi/interface').with_value( params[:interface] ) }
it 'installs cloudkitty-processor package' do it 'installs cloudkitty-processor package' do
is_expected.to contain_package('cloudkitty-processor').with( is_expected.to contain_package('cloudkitty-processor').with(