Merge "Deprecate oslo::middleware related parameters in ::nova::metadata"

This commit is contained in:
Zuul 2019-07-08 13:52:56 +00:00 committed by Gerrit Code Review
commit 77d47ff25a
4 changed files with 44 additions and 35 deletions

View File

@ -297,11 +297,11 @@ as a standalone service, or httpd for being run by a httpd server")
'DEFAULT/metadata_listen': value => $metadata_listen;
'DEFAULT/metadata_listen_port': value => $metadata_listen_port;
}
}
oslo::middleware {'nova_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
max_request_body_size => $max_request_body_size,
}
oslo::middleware {'nova_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
max_request_body_size => $max_request_body_size,
}
nova_config {

View File

@ -8,15 +8,6 @@
# (optional) Shared secret to validate proxies Neutron metadata requests
# Defaults to undef
#
# [*enable_proxy_headers_parsing*]
# (optional) This determines if the HTTPProxyToWSGI
# middleware should parse the proxy headers or not.(boolean value)
# Defaults to $::os_service_default
#
# [*max_request_body_size*]
# (Optional) Set max request body size
# Defaults to $::os_service_default.
#
# [*metadata_cache_expiration*]
# (optional) This option is the time (in seconds) to cache metadata.
# Defaults to $::os_service_default
@ -43,15 +34,24 @@
# (optional) A list of apis to enable
# Defaults to undef.
#
# [*enable_proxy_headers_parsing*]
# (optional) This determines if the HTTPProxyToWSGI
# middleware should parse the proxy headers or not.(boolean value)
# Defaults to undef.
#
# [*max_request_body_size*]
# (Optional) Set max request body size
# Defaults to undef.
#
class nova::metadata(
$neutron_metadata_proxy_shared_secret = undef,
$enable_proxy_headers_parsing = $::os_service_default,
$max_request_body_size = $::os_service_default,
$metadata_cache_expiration = $::os_service_default,
$local_metadata_per_cell = $::os_service_default,
$dhcp_domain = $::os_service_default,
# DEPRECATED PARAMETERS
$enabled_apis = undef,
$enable_proxy_headers_parsing = undef,
$max_request_body_size = undef,
) inherits nova::params {
include ::nova::deps
@ -62,6 +62,15 @@ class nova::metadata(
warning('enabled_apis parameter is deprecated, use nova::compute::enabled_apis instead.')
}
if $enable_proxy_headers_parsing {
warning('enable_proxy_headers_parsing in ::nova::metadata is deprecated, has no effect \
and will be removed in the future. Please use the one ::nova::api.')
}
if $max_request_body_size {
warning('max_request_body_size in ::nova::metadata is deprecated, has no effect \
and will be removed in the future. Please use the one ::nova::api.')
}
# TODO(mwhahaha): backwards compatibility until we drop it from
# nova::network::network
if defined('$::nova::neutron::dhcp_domain') and $::nova::neutron::dhcp_domain != undef {
@ -78,11 +87,6 @@ class nova::metadata(
'api/local_metadata_per_cell': value => $local_metadata_per_cell;
}
oslo::middleware {'nova_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
max_request_body_size => $max_request_body_size,
}
if ($neutron_metadata_proxy_shared_secret){
nova_config {
'neutron/service_metadata_proxy': value => true;

View File

@ -0,0 +1,16 @@
---
deprecations:
- |
Deprecates oslo::middleware parameters enable_proxy_headers_parsing
and max_request_body_size in ::nova::metadata.
Use ::nova::api instead.
fixes:
- |
enable_proxy_headers_parsing should not only be configurabe if
!$nova_metadata_wsgi_enabled , Therefore it needs to be moved outside
the condition.
But at the moment enable_proxy_headers_parsing can also be set via
::nova::metadata which conficts.
This change deprecates oslo::middleware related parameters
enable_proxy_headers_parsing and max_request_body_size in
::nova::metadata. In future ::nova::api should be used instead.

View File

@ -20,11 +20,6 @@ describe 'nova::metadata' do
it { is_expected.to contain_class('nova::keystone::authtoken') }
it 'configures various stuff' do
is_expected.to contain_nova_config('api/metadata_cache_expiration').with('value' => '<SERVICE DEFAULT>')
is_expected.to contain_oslo__middleware('nova_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
:max_request_body_size => '<SERVICE DEFAULT>',
)
is_expected.to contain_nova_config('api/metadata_cache_expiration').with('value' => '<SERVICE DEFAULT>')
is_expected.to contain_nova_config('api/local_metadata_per_cell').with('value' => '<SERVICE DEFAULT>')
is_expected.to contain_nova_config('api/dhcp_domain').with('value' => '<SERVICE DEFAULT>')
@ -39,12 +34,10 @@ describe 'nova::metadata' do
context 'with overridden parameters' do
before do
params.merge!({
:neutron_metadata_proxy_shared_secret => 'secrete',
:enable_proxy_headers_parsing => true,
:max_request_body_size => '102400',
:local_metadata_per_cell => true,
:metadata_cache_expiration => 15,
:dhcp_domain => 'foo',
:neutron_metadata_proxy_shared_secret => 'secrete',
:local_metadata_per_cell => true,
:metadata_cache_expiration => 15,
:dhcp_domain => 'foo',
})
end
@ -54,10 +47,6 @@ describe 'nova::metadata' do
is_expected.to contain_nova_config('api/dhcp_domain').with('value' => 'foo')
is_expected.to contain_nova_config('neutron/service_metadata_proxy').with('value' => true)
is_expected.to contain_nova_config('neutron/metadata_proxy_shared_secret').with('value' => 'secrete').with_secret(true)
is_expected.to contain_oslo__middleware('nova_config').with(
:enable_proxy_headers_parsing => true,
:max_request_body_size => '102400',
)
end
end