From 928ae95ab577a76cafcb98bc8278dacf4b97811e Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 19 Oct 2021 23:00:14 +0900 Subject: [PATCH] Make [statsd] flush_delay optional Gnocchi doesn't require the [statsd] flush_delay parameter, and it defines the default value (10 seconds). There is no reason to require the parameter in puppet layer because the service default is considered to be a reasonable default. Change-Id: I08a33e03f68ea8a8b0cbf1945f02750c83ca7da6 --- manifests/statsd.pp | 5 +++-- ...tatsd-flush_delay-optional-e1aa6d8aac600191.yaml | 6 ++++++ spec/classes/gnocchi_statsd_spec.rb | 13 +++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/statsd-flush_delay-optional-e1aa6d8aac600191.yaml diff --git a/manifests/statsd.pp b/manifests/statsd.pp index da260168..e2c32336 100644 --- a/manifests/statsd.pp +++ b/manifests/statsd.pp @@ -6,7 +6,8 @@ # (required) Resource UUID to use to identify statsd in Gnocchi. # # [*flush_delay*] -# (required) Delay between flushes. +# (optional) Delay between flushes. +# Defaults to $::os_service_default # # [*enabled*] # (optional) Should the service be enabled. @@ -26,7 +27,7 @@ # class gnocchi::statsd ( $resource_id, - $flush_delay, + $flush_delay = $::os_service_default, $archive_policy_name = undef, $manage_service = true, $enabled = true, diff --git a/releasenotes/notes/statsd-flush_delay-optional-e1aa6d8aac600191.yaml b/releasenotes/notes/statsd-flush_delay-optional-e1aa6d8aac600191.yaml new file mode 100644 index 00000000..03e82aa9 --- /dev/null +++ b/releasenotes/notes/statsd-flush_delay-optional-e1aa6d8aac600191.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The ``gnocchi::statsd::flush_delay`` is now optional and defaults to + ``$::os_service_default`` which effectively use the default value defined + in Gnocchi itself. diff --git a/spec/classes/gnocchi_statsd_spec.rb b/spec/classes/gnocchi_statsd_spec.rb index 6e43e42e..016fd504 100644 --- a/spec/classes/gnocchi_statsd_spec.rb +++ b/spec/classes/gnocchi_statsd_spec.rb @@ -7,7 +7,6 @@ describe 'gnocchi::statsd' do :manage_service => true, :resource_id => '07f26121-5777-48ba-8a0b-d70468133dd9', :archive_policy_name => 'high', - :flush_delay => '200', } end @@ -27,7 +26,7 @@ describe 'gnocchi::statsd' do it 'configures gnocchi statsd' do is_expected.to contain_gnocchi_config('statsd/resource_id').with_value('07f26121-5777-48ba-8a0b-d70468133dd9') is_expected.to contain_gnocchi_config('statsd/archive_policy_name').with_value('high') - is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value('200') + is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value('') end [{:enabled => true}, {:enabled => false}].each do |param_hash| @@ -67,6 +66,16 @@ describe 'gnocchi::statsd' do ) end end + + context 'with flush_delay' do + before do + params.merge!({ :flush_delay => 10 }) + end + + it 'configures the parameter' do + is_expected.to contain_gnocchi_config('statsd/flush_delay').with_value(10) + end + end end on_supported_os({