Deprecate meter_dispatcher and event_dispatcher options

1) meter_dispatcher and event_dispatcher options are now deprecated,
please use meter_dispatchers and event_dispatchers options instead.
2) Switch meter_dispatchers and event_dispatchers parameters to
$::os_service_default fact.

Change-Id: I32dcbf34160906d15c871272e5ce0eba46c02b5e
Closes-Bug: #1668817
This commit is contained in:
ZhongShengping 2017-03-03 15:19:07 +08:00
parent 72b33608c7
commit 8190fba40a
4 changed files with 47 additions and 11 deletions

View File

@ -30,7 +30,7 @@ class { '::ceilometer::wsgi::apache':
}
class { '::ceilometer::collector':
meter_dispatcher => ['gnocchi'],
meter_dispatchers => ['gnocchi'],
}
class { '::ceilometer::dispatcher::gnocchi':
filter_service_activity => false,

View File

@ -25,20 +25,32 @@
# (Optional) the ceilometer collector udp bind port.
# Defaults to '4952'.
#
# [*meter_dispatcher*]
# [*meter_dispatchers*]
# (Optional) dispatcher driver(s) to process meter data.
# Can be an array or a string.
# Defaults to 'database'.
# Defaults to $::os_service_default.
#
# [*event_dispatcher*]
# [*event_dispatchers*]
# (Optional) dispatcher driver(s) to process event data.
# Can be an array or a string.
# Defaults to 'database'.
# Defaults to $::os_service_default.
#
# [*collector_workers*]
# (Optional) Number of workers for collector service (integer value).
# Defaults to $::os_service_default.
#
# DEPRECATED PARAMETERS
#
# [*meter_dispatcher*]
# (Optional) dispatcher driver(s) to process meter data.
# Can be an array or a string.
# Defaults to undef.
#
# [*event_dispatcher*]
# (Optional) dispatcher driver(s) to process event data.
# Can be an array or a string.
# Defaults to undef.
#
class ceilometer::collector (
$manage_service = true,
$enabled = true,
@ -46,8 +58,11 @@ class ceilometer::collector (
$udp_address = '0.0.0.0',
$udp_port = '4952',
$collector_workers = $::os_service_default,
$meter_dispatcher = 'database',
$event_dispatcher = 'database',
$meter_dispatchers = $::os_service_default,
$event_dispatchers = $::os_service_default,
# DEPRECATED PARAMETERS
$meter_dispatcher = undef,
$event_dispatcher = undef,
) {
include ::ceilometer::deps
@ -59,12 +74,26 @@ class ceilometer::collector (
fail("${udp_address} is not a valid ip and is not empty")
}
if $meter_dispatcher {
warning('The meter_dispatcher parameter is deprecated, please use meter_dispatchers instead.')
$meter_dispatchers_real = $meter_dispatcher
} else {
$meter_dispatchers_real = $meter_dispatchers
}
if $event_dispatcher {
warning('The event_dispatcher parameter is deprecated, please use event_dispatchers instead.')
$event_dispatchers_real = $event_dispatcher
} else {
$event_dispatchers_real = $event_dispatchers
}
ceilometer_config {
'collector/udp_address': value => $udp_address;
'collector/udp_port': value => $udp_port;
'collector/workers': value => $collector_workers;
'DEFAULT/meter_dispatchers': value => join(any2array($meter_dispatcher), ',');
'DEFAULT/event_dispatchers': value => join(any2array($event_dispatcher), ',');
'DEFAULT/meter_dispatchers': value => join(any2array($meter_dispatchers_real), ',');
'DEFAULT/event_dispatchers': value => join(any2array($event_dispatchers_real), ',');
}
ensure_resource( 'package', [$::ceilometer::params::collector_package_name],

View File

@ -0,0 +1,7 @@
---
deprecations:
- meter_dispatcher and event_dispatcher options are now deprecated,
please use meter_dispatchers and event_dispatchers options instead.
other:
- Switch meter_dispatchers and event_dispatchers parameters to
$::os_service_default fact.

View File

@ -52,8 +52,8 @@ describe 'ceilometer::collector' do
is_expected.to contain_ceilometer_config('collector/udp_address').with_value( '0.0.0.0' )
is_expected.to contain_ceilometer_config('collector/udp_port').with_value( '4952' )
is_expected.to contain_ceilometer_config('collector/workers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ceilometer_config('DEFAULT/meter_dispatchers').with_value( 'database' )
is_expected.to contain_ceilometer_config('DEFAULT/event_dispatchers').with_value( 'database' )
is_expected.to contain_ceilometer_config('DEFAULT/meter_dispatchers').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_ceilometer_config('DEFAULT/event_dispatchers').with_value( '<SERVICE DEFAULT>' )
end
it 'installs ceilometer-collector package' do