Merge "Add support for [api] paste_config"

This commit is contained in:
Zuul 2021-12-08 02:22:48 +00:00 committed by Gerrit Code Review
commit b5866f1db7
3 changed files with 21 additions and 2 deletions

View File

@ -37,6 +37,10 @@
# Can be set to noauth and keystone.
# Defaults to 'keystone'.
#
# [*paste_config*]
# (Optional) Path to API paste configuration.
# Defaults to $:;os_service_default
#
# [*enable_proxy_headers_parsing*]
# (Optional) Enable paste middleware to handle SSL requests through
# HTTPProxyToWSGI middleware.
@ -60,6 +64,7 @@ class gnocchi::api (
$service_name = $::gnocchi::params::api_service_name,
$sync_db = false,
$auth_strategy = 'keystone',
$paste_config = $::os_service_default,
$enable_proxy_headers_parsing = $::os_service_default,
$max_request_body_size = $::os_service_default,
# DEPRECATED PARAMETERS
@ -122,8 +127,9 @@ 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/max_limit': value => $max_limit;
'api/auth_mode': value => $auth_strategy;
'api/paste_config': value => $paste_config;
}
oslo::middleware { 'gnocchi_config':

View File

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

View File

@ -60,6 +60,7 @@ describe 'gnocchi::api' do
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/auth_mode').with_value('keystone')
is_expected.to contain_gnocchi_config('api/paste_config').with_value('<SERVICE DEFAULT>')
is_expected.to contain_oslo__middleware('gnocchi_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
:max_request_body_size => '<SERVICE DEFAULT>',
@ -155,6 +156,14 @@ describe 'gnocchi::api' do
it_raises 'a Puppet::Error', /Invalid service_name/
end
context 'with paste_config' do
before do
params.merge!({:paste_config => 'api-paste.ini' })
end
it { is_expected.to contain_gnocchi_config('api/paste_config').with_value('api-paste.ini') }
end
context 'with enable_proxy_headers_parsing' do
before do
params.merge!({:enable_proxy_headers_parsing => true })