From 04301ef4496150f32cb5bb0d2e69ab2a7be13570 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 22 Mar 2022 17:07:32 +0900 Subject: [PATCH] Support [api] operation_timeout Change-Id: Iccc6b6f0632c7b20b0e2385467ae0cd459928128 --- manifests/api.pp | 15 ++++++++--- ...pi-operation_timeout-909cae1732afee42.yaml | 4 +++ spec/classes/gnocchi_api_spec.rb | 26 +++++++++++++++---- 3 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/api-operation_timeout-909cae1732afee42.yaml diff --git a/manifests/api.pp b/manifests/api.pp index d6f0f4b8..11e8b36b 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -39,7 +39,12 @@ # # [*paste_config*] # (Optional) Path to API paste configuration. -# Defaults to $:;os_service_default +# Defaults to $::os_service_default. +# +# [*operation_timeout*] +# (Optional) Number of seconds before timeout when attempting to do some +# operations. +# Defaults to $::os_service_default. # # [*enable_proxy_headers_parsing*] # (Optional) Enable paste middleware to handle SSL requests through @@ -65,6 +70,7 @@ class gnocchi::api ( $sync_db = false, $auth_strategy = 'keystone', $paste_config = $::os_service_default, + $operation_timeout = $::os_service_default, $enable_proxy_headers_parsing = $::os_service_default, $max_request_body_size = $::os_service_default, # DEPRECATED PARAMETERS @@ -125,9 +131,10 @@ standalone service, or httpd for being run by a httpd server") } gnocchi_config { - 'api/max_limit': value => $max_limit; - 'api/auth_mode': value => $auth_strategy; - 'api/paste_config': value => $paste_config; + 'api/max_limit': value => $max_limit; + 'api/auth_mode': value => $auth_strategy; + 'api/paste_config': value => $paste_config; + 'api/operation_timeout': value => $operation_timeout; } oslo::middleware { 'gnocchi_config': diff --git a/releasenotes/notes/api-operation_timeout-909cae1732afee42.yaml b/releasenotes/notes/api-operation_timeout-909cae1732afee42.yaml new file mode 100644 index 00000000..ffa48b74 --- /dev/null +++ b/releasenotes/notes/api-operation_timeout-909cae1732afee42.yaml @@ -0,0 +1,4 @@ +--- +features: + - | + The ``gnochi::api::operation_timeout`` parameter has been added. diff --git a/spec/classes/gnocchi_api_spec.rb b/spec/classes/gnocchi_api_spec.rb index 7405cb2d..9e83dcbb 100644 --- a/spec/classes/gnocchi_api_spec.rb +++ b/spec/classes/gnocchi_api_spec.rb @@ -11,10 +11,9 @@ describe 'gnocchi::api' do end let :params do - { :enabled => true, - :manage_service => true, - :package_ensure => 'latest', - :max_limit => '1000', + { :enabled => true, + :manage_service => true, + :package_ensure => 'latest', } end @@ -58,9 +57,10 @@ describe 'gnocchi::api' do end it 'configures gnocchi-api' do - is_expected.to contain_gnocchi_config('api/max_limit').with_value( params[:max_limit] ) + is_expected.to contain_gnocchi_config('api/max_limit').with_value(1000) is_expected.to contain_gnocchi_config('api/auth_mode').with_value('keystone') is_expected.to contain_gnocchi_config('api/paste_config').with_value('') + is_expected.to contain_gnocchi_config('api/operation_timeout').with_value('') is_expected.to contain_oslo__middleware('gnocchi_config').with( :enable_proxy_headers_parsing => '', :max_request_body_size => '', @@ -149,6 +149,14 @@ describe 'gnocchi::api' do it_raises 'a Puppet::Error', /Invalid service_name/ end + context 'with max_limit' do + before do + params.merge!({:max_limit => 1001 }) + end + + it { is_expected.to contain_gnocchi_config('api/max_limit').with_value(1001) } + end + context 'with paste_config' do before do params.merge!({:paste_config => 'api-paste.ini' }) @@ -157,6 +165,14 @@ describe 'gnocchi::api' do it { is_expected.to contain_gnocchi_config('api/paste_config').with_value('api-paste.ini') } end + context 'with operation_timeout' do + before do + params.merge!({:operation_timeout => 10 }) + end + + it { is_expected.to contain_gnocchi_config('api/operation_timeout').with_value(10) } + end + context 'with enable_proxy_headers_parsing' do before do params.merge!({:enable_proxy_headers_parsing => true })