Add support for [statsd] creator

Change-Id: I719ff8386c7ea73cbaeae4d7db8cc6ed82b8cf79
This commit is contained in:
Takashi Kajinami 2022-04-25 08:51:35 +09:00
parent 4bd702bc91
commit bdde282558
3 changed files with 26 additions and 5 deletions

View File

@ -17,6 +17,14 @@
# (optional) Delay between flushes. # (optional) Delay between flushes.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*archive_policy_name*]
# (optional) Archive policy name to use when creating metrics.
# Defaults to $::os_service_default.
#
# [*creator*]
# (required) Creator value to use to identify statsd in Gnocchi.
# Defaults to $::os_service_default.
#
# [*enabled*] # [*enabled*]
# (optional) Should the service be enabled. # (optional) Should the service be enabled.
# Defaults to true # Defaults to true
@ -29,16 +37,13 @@
# (optional) Whether the service should be managed by Puppet. # (optional) Whether the service should be managed by Puppet.
# Defaults to true. # Defaults to true.
# #
# [*archive_policy_name*]
# (optional) Archive policy name to use when creating metrics.
# Defaults to $::os_service_default.
#
class gnocchi::statsd ( class gnocchi::statsd (
$resource_id, $resource_id,
$host = $::os_service_default, $host = $::os_service_default,
$port = $::os_service_default, $port = $::os_service_default,
$flush_delay = $::os_service_default, $flush_delay = $::os_service_default,
$archive_policy_name = $::os_service_default, $archive_policy_name = $::os_service_default,
$creator = $::os_service_default,
$manage_service = true, $manage_service = true,
$enabled = true, $enabled = true,
$package_ensure = 'present', $package_ensure = 'present',
@ -73,8 +78,9 @@ class gnocchi::statsd (
'statsd/resource_id' : value => $resource_id; 'statsd/resource_id' : value => $resource_id;
'statsd/host' : value => $host; 'statsd/host' : value => $host;
'statsd/port' : value => $port; 'statsd/port' : value => $port;
'statsd/archive_policy_name' : value => $archive_policy_name;
'statsd/flush_delay' : value => $flush_delay; 'statsd/flush_delay' : value => $flush_delay;
'statsd/archive_policy_name' : value => $archive_policy_name;
'statsd/creator' : value => $creator;
} }
} }

View File

@ -0,0 +1,4 @@
---
features:
- |
The new ``gnocchi::statsd::creator`` parameter has been added.

View File

@ -28,6 +28,7 @@ describe 'gnocchi::statsd' do
is_expected.to contain_gnocchi_config('statsd/port').with_value('<SERVICE DEFAULT>') is_expected.to contain_gnocchi_config('statsd/port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value('<SERVICE DEFAULT>') is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value('<SERVICE DEFAULT>')
is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('<SERVICE DEFAULT>') is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_gnocchi_config('statsd/creator').with_value('<SERVICE DEFAULT>')
end end
[{:enabled => true}, {:enabled => false}].each do |param_hash| [{:enabled => true}, {:enabled => false}].each do |param_hash|
@ -94,6 +95,16 @@ describe 'gnocchi::statsd' do
is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('high') is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('high')
end end
end end
context 'with creator' do
before do
params.merge!({ :creator => 'creator' })
end
it 'configures the parameter' do
is_expected.to contain_gnocchi_config('statsd/creator').with_value('creator')
end
end
end end
on_supported_os({ on_supported_os({