Set DEFAULT/enabled_apis in nova::api

enabled_apis [1] won't get set in nova::api when
nova_metadata_wsgi_enabled == true.
But the enabled_apis list get also modified for this case, so
we need to move setting the config outside the conditional at [3].
Since the config is right now also set in nova::metadata this
deprecates it in nova::metadata to only use nova::api.

Related-Bug: #1832537

[1] https://github.com/openstack/puppet-nova/blob/master/manifests/api.pp#L401
[2] https://github.com/openstack/puppet-nova/blob/master/manifests/api.pp#L353
[3] https://github.com/openstack/puppet-nova/blob/master/manifests/api.pp#L379

Change-Id: Ifd751feecb4bdbece138fec3a7c90ba5377bd0d0
This commit is contained in:
Martin Schuppert 2019-06-13 14:45:59 +02:00
parent 6ba4a0029e
commit 919a4ce5a9
4 changed files with 19 additions and 8 deletions

View File

@ -398,7 +398,6 @@ as a standalone service, or httpd for being run by a httpd server")
} }
nova_config { nova_config {
'DEFAULT/enabled_apis': value => join($enabled_apis_real, ',');
'DEFAULT/metadata_workers': value => $metadata_workers; 'DEFAULT/metadata_workers': value => $metadata_workers;
'DEFAULT/metadata_listen': value => $metadata_listen; 'DEFAULT/metadata_listen': value => $metadata_listen;
'DEFAULT/metadata_listen_port': value => $metadata_listen_port; 'DEFAULT/metadata_listen_port': value => $metadata_listen_port;
@ -424,6 +423,7 @@ as a standalone service, or httpd for being run by a httpd server")
} }
nova_config { nova_config {
'DEFAULT/enabled_apis': value => join($enabled_apis_real, ',');
'wsgi/api_paste_config': value => $api_paste_config; 'wsgi/api_paste_config': value => $api_paste_config;
'DEFAULT/osapi_compute_listen': value => $api_bind_address; 'DEFAULT/osapi_compute_listen': value => $api_bind_address;
'DEFAULT/osapi_compute_listen_port': value => $osapi_compute_listen_port; 'DEFAULT/osapi_compute_listen_port': value => $osapi_compute_listen_port;

View File

@ -4,10 +4,6 @@
# #
# === Parameters # === Parameters
# #
# [*enabled_apis*]
# (optional) A list of apis to enable
# Defaults to ['metadata'] in case of wsgi
#
# [*neutron_metadata_proxy_shared_secret*] # [*neutron_metadata_proxy_shared_secret*]
# (optional) Shared secret to validate proxies Neutron metadata requests # (optional) Shared secret to validate proxies Neutron metadata requests
# Defaults to undef # Defaults to undef
@ -39,6 +35,10 @@
# #
# DEPRECATED # DEPRECATED
# #
# [*enabled_apis*]
# (optional) A list of apis to enable
# Defaults to undef.
#
# [*vendordata_jsonfile_path*] # [*vendordata_jsonfile_path*]
# (optional) Represent the path to the data file. # (optional) Represent the path to the data file.
# Cloud providers may store custom data in vendor data file that will then be # Cloud providers may store custom data in vendor data file that will then be
@ -106,13 +106,13 @@
# Defaults to undef. # Defaults to undef.
# #
class nova::metadata( class nova::metadata(
$enabled_apis = 'metadata',
$neutron_metadata_proxy_shared_secret = undef, $neutron_metadata_proxy_shared_secret = undef,
$enable_proxy_headers_parsing = $::os_service_default, $enable_proxy_headers_parsing = $::os_service_default,
$metadata_cache_expiration = $::os_service_default, $metadata_cache_expiration = $::os_service_default,
$local_metadata_per_cell = $::os_service_default, $local_metadata_per_cell = $::os_service_default,
$dhcp_domain = $::os_service_default, $dhcp_domain = $::os_service_default,
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$enabled_apis = undef,
$vendordata_jsonfile_path = undef, $vendordata_jsonfile_path = undef,
$vendordata_providers = undef, $vendordata_providers = undef,
$vendordata_dynamic_targets = undef, $vendordata_dynamic_targets = undef,
@ -153,6 +153,10 @@ class nova::metadata(
vendordata_caller => 'metadata', vendordata_caller => 'metadata',
} }
if $enabled_apis != undef {
warning('enabled_apis parameter is deprecated, use nova::compute::enabled_apis instead.')
}
# TODO(mwhahaha): backwards compatibility until we drop it from # TODO(mwhahaha): backwards compatibility until we drop it from
# nova::network::network # nova::network::network
if defined('$::nova::neutron::dhcp_domain') and $::nova::neutron::dhcp_domain != undef { if defined('$::nova::neutron::dhcp_domain') and $::nova::neutron::dhcp_domain != undef {
@ -165,7 +169,6 @@ class nova::metadata(
}) })
nova_config { nova_config {
'DEFAULT/enabled_apis': value => $enabled_apis;
'api/metadata_cache_expiration': value => $metadata_cache_expiration; 'api/metadata_cache_expiration': value => $metadata_cache_expiration;
'api/local_metadata_per_cell': value => $local_metadata_per_cell; 'api/local_metadata_per_cell': value => $local_metadata_per_cell;
} }

View File

@ -0,0 +1,9 @@
---
fixes:
- |
enabled_apis won't get set in nova::api when
nova_metadata_wsgi_enabled == true.
But the enabled_apis list get also modified for this case, so
we need to move setting the config outside the conditional.
Since the config is right now also set in nova::metadata this
deprecates it in nova::metadata to only use nova::api.

View File

@ -20,7 +20,6 @@ describe 'nova::metadata' do
it { is_expected.to contain_class('nova::keystone::authtoken') } it { is_expected.to contain_class('nova::keystone::authtoken') }
it 'configures various stuff' do it 'configures various stuff' do
is_expected.to contain_nova_config('DEFAULT/enabled_apis').with('value' => 'metadata')
is_expected.to contain_nova_config('api/metadata_cache_expiration').with('value' => '<SERVICE DEFAULT>') is_expected.to contain_nova_config('api/metadata_cache_expiration').with('value' => '<SERVICE DEFAULT>')
is_expected.to contain_oslo__middleware('nova_config').with( is_expected.to contain_oslo__middleware('nova_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>', :enable_proxy_headers_parsing => '<SERVICE DEFAULT>',