Manage oslo_middleware/max_request_body_size

So that we can increase it from the default 114688

Useful in case for example the OS-Federation mapping is too large.

If this limit is breached panko will return a 413 Entity Too Large
and not log anything to panko.log.

Change-Id: Ifc011b5a261b7dfd13edf606c8f3cc711ca53489
Closes-Bug: #1835161
This commit is contained in:
ZhongShengping 2019-07-04 11:34:44 +08:00
parent 5f69567dc7
commit dfdb5f7d53
3 changed files with 22 additions and 0 deletions

View File

@ -54,6 +54,10 @@
# HTTPProxyToWSGI middleware.
# Defaults to $::os_service_default.
#
# [*max_request_body_size*]
# (Optional) Set max request body size
# Defaults to $::os_service_default.
#
# [*max_retries*]
# (Optional) Maximum number of connection retries during startup.
# Set to -1 to specify an infinite retry count. (integer value)
@ -88,6 +92,7 @@ class panko::api (
$sync_db = false,
$auth_strategy = 'keystone',
$enable_proxy_headers_parsing = $::os_service_default,
$max_request_body_size = $::os_service_default,
$max_retries = $::os_service_default,
$retry_interval = $::os_service_default,
$es_ssl_enabled = $::os_service_default,
@ -172,6 +177,7 @@ running as a standalone service, or httpd for being run by a httpd server")
oslo::middleware { 'panko_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
max_request_body_size => $max_request_body_size,
}
}

View File

@ -0,0 +1,5 @@
---
features:
- |
Add support to configure `[oslo_middleware]/max_request_body_size` with
`$max_request_body_size`.

View File

@ -50,6 +50,7 @@ describe 'panko::api' do
is_expected.to contain_panko_config('storage/es_index_name').with_value(params[:es_index_name])
is_expected.to contain_oslo__middleware('panko_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
:max_request_body_size => '<SERVICE DEFAULT>',
)
is_expected.to contain_panko_config('database/event_time_to_live').with_value( params[:event_time_to_live] )
end
@ -93,6 +94,16 @@ describe 'panko::api' do
)}
end
context 'with max_request_body_size' do
before do
params.merge!({:max_request_body_size => '102400' })
end
it { is_expected.to contain_oslo__middleware('panko_config').with(
:max_request_body_size => '102400',
)}
end
context 'with disabled service managing' do
before do
params.merge!({