Merge "Error when using ceilometer collector"

This commit is contained in:
Zuul 2018-03-23 14:17:36 +00:00 committed by Gerrit Code Review
commit 3a12d60207
3 changed files with 17 additions and 43 deletions

View File

@ -18,7 +18,7 @@
#
# [*collector*]
# (Optional) Data collector.
# Defaults to 'ceilometer'.
# Defaults to 'gnocchi'.
#
# [*window*]
# (Optional) Number of samples to collect per call.
@ -48,7 +48,7 @@ class cloudkitty::processor (
$package_ensure = 'present',
$manage_service = true,
$enabled = true,
$collector = 'ceilometer',
$collector = 'gnocchi',
$window = $::os_service_default,
$period = $::os_service_default,
$wait_periods = $::os_service_default,
@ -90,30 +90,15 @@ class cloudkitty::processor (
'collect/services': value => $services;
}
if $collector == 'ceilometer' {
cloudkitty_config{
'ceilometer_collector/auth_type': value => $auth_type;
'ceilometer_collector/auth_section': value => $auth_section
}
cloudkitty_config {
'gnocchi_collector/auth_type': ensure => absent;
'gnocchi_collector/auth_section': ensure => absent;
}
$collector_real = $collector
} else{
warning('Valid values of the collector option are ceilometer and gnocchi')
cloudkitty_config{
'gnocchi_collector/auth_type': value => $auth_type;
'gnocchi_collector/auth_section': value => $auth_section;
}
cloudkitty_config {
'ceilometer_collector/auth_type': ensure => absent;
'ceilometer_collector/auth_section': ensure => absent;
}
$collector_real = 'gnocchi'
if $collector != 'gnocchi' {
warning('Valid value of the collector option is gnocchi')
$collector = 'gnocchi'
}
cloudkitty_config {
'collect/collector': value => $collector_real;
'collect/collector': value => $collector;
'gnocchi_collector/auth_type': value => $auth_type;
'gnocchi_collector/auth_section': value => $auth_section
}
}

View File

@ -0,0 +1,5 @@
---
other:
- Change default value from 'ceilometer' to 'gnocchi' for collector option in
::cloudkitty::processer class. Because the ceilometer collector has been
removed in cloudkitty repo.

View File

@ -5,7 +5,7 @@ describe 'cloudkitty::processor' do
let :params do
{ :enabled => true,
:manage_service => true,
:collector => 'ceilometer',
:collector => 'gnocchi',
:period => '60',
:wait_periods => '1',
:window => '3600',}
@ -21,10 +21,8 @@ describe 'cloudkitty::processor' do
it { is_expected.to contain_cloudkitty_config('collect/window').with_value( params[:window] ) }
it { is_expected.to contain_cloudkitty_config('collect/period').with_value( params[:period] ) }
it { is_expected.to contain_cloudkitty_config('collect/wait_periods').with_value( params[:wait_periods] ) }
it { is_expected.to contain_cloudkitty_config('ceilometer_collector/auth_type').with_value('password') }
it { is_expected.to contain_cloudkitty_config('ceilometer_collector/auth_section').with_value('keystone_authtoken') }
it { is_expected.to contain_cloudkitty_config('gnocchi_collector/auth_type').with_ensure('absent') }
it { is_expected.to contain_cloudkitty_config('gnocchi_collector/auth_section').with_ensure('absent') }
it { is_expected.to contain_cloudkitty_config('gnocchi_collector/auth_type').with_value('password') }
it { is_expected.to contain_cloudkitty_config('gnocchi_collector/auth_section').with_value('keystone_authtoken') }
it 'installs cloudkitty-processor package' do
is_expected.to contain_package('cloudkitty-processor').with(
@ -47,20 +45,6 @@ describe 'cloudkitty::processor' do
end
context 'with gnocchi backend' do
before do
params.merge!({
:collector => 'gnocchi',
})
end
it { is_expected.to contain_cloudkitty_config('collect/collector').with_value( params[:collector] ) }
it { is_expected.to contain_cloudkitty_config('gnocchi_collector/auth_type').with_value('password') }
it { is_expected.to contain_cloudkitty_config('gnocchi_collector/auth_section').with_value('keystone_authtoken') }
it { is_expected.to contain_cloudkitty_config('ceilometer_collector/auth_type').with_ensure('absent') }
it { is_expected.to contain_cloudkitty_config('ceilometer_collector/auth_section').with_ensure('absent') }
end
context 'when disabled' do
let :params do
{ :enabled => false }