listener: Add support for tunable parameters
Change-Id: Iaa9199dde153cfd218171a0b23c724bad421529c
This commit is contained in:
parent
e4916c32c8
commit
9400853421
|
@ -1,34 +1,53 @@
|
|||
# Installs the aodh listener service
|
||||
#
|
||||
# == Params
|
||||
# [*enabled*]
|
||||
# (optional) Should the service be enabled.
|
||||
# Defaults to true.
|
||||
# [*enabled*]
|
||||
# (optional) Should the service be enabled.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*manage_service*]
|
||||
# (optional) Whether the service should be managed by Puppet.
|
||||
# Defaults to true.
|
||||
# [*manage_service*]
|
||||
# (optional) Whether the service should be managed by Puppet.
|
||||
# Defaults to true.
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) ensure state for package.
|
||||
# Defaults to 'present'
|
||||
# [*package_ensure*]
|
||||
# (optional) ensure state for package.
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*workers*]
|
||||
# (optional) Number of workers for evaluator service.
|
||||
# Defaults to $::os_workers.
|
||||
# [*workers*]
|
||||
# (optional) Number of workers for evaluator service.
|
||||
# Defaults to $::os_workers.
|
||||
#
|
||||
# [*event_alarm_topic*]
|
||||
# (optional) The topic that aodh uses for event alarm evaluation.
|
||||
# Defualts to $::os_service_default.
|
||||
#
|
||||
# [*batch_size*]
|
||||
# (optional) Number of notification messages to wait before dispatching them.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*batch_timeout*]
|
||||
# (optional) Number of seconds to wait before dispatching samples when
|
||||
# batch_size is not reached.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class aodh::listener (
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
$package_ensure = 'present',
|
||||
$workers = $::os_workers,
|
||||
$manage_service = true,
|
||||
$enabled = true,
|
||||
$package_ensure = 'present',
|
||||
$workers = $::os_workers,
|
||||
$event_alarm_topic = $::os_service_default,
|
||||
$batch_size = $::os_service_default,
|
||||
$batch_timeout = $::os_service_default,
|
||||
) {
|
||||
|
||||
include aodh::deps
|
||||
include aodh::params
|
||||
|
||||
aodh_config {
|
||||
'listener/workers': value => $workers
|
||||
'listener/workers': value => $workers;
|
||||
'listener/event_alarm_topic': value => $event_alarm_topic;
|
||||
'listener/batch_size': value => $batch_size;
|
||||
'listener/batch_timeout': value => $batch_timeout;
|
||||
}
|
||||
|
||||
package { 'aodh-listener':
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The ``aodh::listener`` class now supports the following three new
|
||||
parameters.
|
||||
|
||||
- ``event_alarm_topic``
|
||||
- ``batch_size``
|
||||
- ``batch_timeout``
|
|
@ -8,17 +8,7 @@ describe 'aodh::listener' do
|
|||
|
||||
shared_examples_for 'aodh-listener' do
|
||||
|
||||
context 'with workers' do
|
||||
let :params do
|
||||
{ :workers => 8 }
|
||||
end
|
||||
|
||||
it 'configures workers' do
|
||||
is_expected.to contain_aodh_config('listener/workers').with_value(8)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when enabled' do
|
||||
context 'with defaults' do
|
||||
it { is_expected.to contain_class('aodh::params') }
|
||||
|
||||
it 'installs aodh-listener package' do
|
||||
|
@ -42,6 +32,9 @@ describe 'aodh::listener' do
|
|||
|
||||
it 'sets default values' do
|
||||
is_expected.to contain_aodh_config('listener/workers').with_value(4)
|
||||
is_expected.to contain_aodh_config('listener/event_alarm_topic').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_aodh_config('listener/batch_size').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_aodh_config('listener/batch_timeout').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -74,6 +67,24 @@ describe 'aodh::listener' do
|
|||
is_expected.to_not contain_service('aodh-listener')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters' do
|
||||
let :params do
|
||||
{
|
||||
:workers => 8,
|
||||
:event_alarm_topic => 'alarm.all',
|
||||
:batch_size => 1,
|
||||
:batch_timeout => 60,
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures the given values' do
|
||||
is_expected.to contain_aodh_config('listener/workers').with_value(8)
|
||||
is_expected.to contain_aodh_config('listener/event_alarm_topic').with_value('alarm.all')
|
||||
is_expected.to contain_aodh_config('listener/batch_size').with_value(1)
|
||||
is_expected.to contain_aodh_config('listener/batch_timeout').with_value(60)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
|
Loading…
Reference in New Issue