Add auth_section and auth_type params

Change-Id: I9dcb506bcc716e5d6c518cf43f58fd27ed36e131
This commit is contained in:
Xingchao Yu
2017-03-24 15:44:45 +08:00
committed by Xingchao Yu
parent 79a6facaf0
commit 10ee536270
2 changed files with 22 additions and 2 deletions

View File

@@ -36,6 +36,14 @@
# (optional) Services to monitor.
# Defaults to $::os_service_default.
#
# [*auth_type*]
# (optional) Authentication type to load.
# Default to 'password'.
#
# [*auth_section*]
# (optional) Config Section from which to load plugin specific options
# Default to 'keystone_authtoken'.
#
class cloudkitty::processor (
$package_ensure = 'present',
$manage_service = true,
@@ -45,6 +53,8 @@ class cloudkitty::processor (
$period = $::os_service_default,
$wait_periods = $::os_service_default,
$services = $::os_service_default,
$auth_type = 'password',
$auth_section = 'keystone_authtoken',
) {
include ::cloudkitty::deps
@@ -82,18 +92,22 @@ class cloudkitty::processor (
if $collector == 'ceilometer' {
cloudkitty_config{
'ceilometer_collector/auth_section': value => 'keystone_authtoken';
'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_section': value => 'keystone_authtoken';
'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'

View File

@@ -21,7 +21,10 @@ 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 'installs cloudkitty-processor package' do
is_expected.to contain_package('cloudkitty-processor').with(
@@ -52,7 +55,10 @@ describe 'cloudkitty::processor' do
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