From 919a4ce5a9942393403804635676e493420117f3 Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Thu, 13 Jun 2019 14:45:59 +0200 Subject: [PATCH] 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 --- manifests/api.pp | 2 +- manifests/metadata.pp | 15 +++++++++------ ...a_deprecate_enabled_apis-1ec89bc5bee440ff.yaml | 9 +++++++++ spec/classes/nova_metadata_spec.rb | 1 - 4 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 releasenotes/notes/nova_metadata_deprecate_enabled_apis-1ec89bc5bee440ff.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 0aac0fa59..d2eefccf9 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -398,7 +398,6 @@ as a standalone service, or httpd for being run by a httpd server") } nova_config { - 'DEFAULT/enabled_apis': value => join($enabled_apis_real, ','); 'DEFAULT/metadata_workers': value => $metadata_workers; 'DEFAULT/metadata_listen': value => $metadata_listen; '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 { + 'DEFAULT/enabled_apis': value => join($enabled_apis_real, ','); 'wsgi/api_paste_config': value => $api_paste_config; 'DEFAULT/osapi_compute_listen': value => $api_bind_address; 'DEFAULT/osapi_compute_listen_port': value => $osapi_compute_listen_port; diff --git a/manifests/metadata.pp b/manifests/metadata.pp index 8d9dfd98a..4500943d8 100644 --- a/manifests/metadata.pp +++ b/manifests/metadata.pp @@ -4,10 +4,6 @@ # # === Parameters # -# [*enabled_apis*] -# (optional) A list of apis to enable -# Defaults to ['metadata'] in case of wsgi -# # [*neutron_metadata_proxy_shared_secret*] # (optional) Shared secret to validate proxies Neutron metadata requests # Defaults to undef @@ -39,6 +35,10 @@ # # DEPRECATED # +# [*enabled_apis*] +# (optional) A list of apis to enable +# Defaults to undef. +# # [*vendordata_jsonfile_path*] # (optional) Represent the path to the data file. # Cloud providers may store custom data in vendor data file that will then be @@ -106,13 +106,13 @@ # Defaults to undef. # class nova::metadata( - $enabled_apis = 'metadata', $neutron_metadata_proxy_shared_secret = undef, $enable_proxy_headers_parsing = $::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, $vendordata_jsonfile_path = undef, $vendordata_providers = undef, $vendordata_dynamic_targets = undef, @@ -153,6 +153,10 @@ class nova::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 # nova::network::network if defined('$::nova::neutron::dhcp_domain') and $::nova::neutron::dhcp_domain != undef { @@ -165,7 +169,6 @@ class nova::metadata( }) nova_config { - 'DEFAULT/enabled_apis': value => $enabled_apis; 'api/metadata_cache_expiration': value => $metadata_cache_expiration; 'api/local_metadata_per_cell': value => $local_metadata_per_cell; } diff --git a/releasenotes/notes/nova_metadata_deprecate_enabled_apis-1ec89bc5bee440ff.yaml b/releasenotes/notes/nova_metadata_deprecate_enabled_apis-1ec89bc5bee440ff.yaml new file mode 100644 index 000000000..ac27d337b --- /dev/null +++ b/releasenotes/notes/nova_metadata_deprecate_enabled_apis-1ec89bc5bee440ff.yaml @@ -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. diff --git a/spec/classes/nova_metadata_spec.rb b/spec/classes/nova_metadata_spec.rb index b22ed3fb3..5286d8312 100644 --- a/spec/classes/nova_metadata_spec.rb +++ b/spec/classes/nova_metadata_spec.rb @@ -20,7 +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('DEFAULT/enabled_apis').with('value' => 'metadata') is_expected.to contain_nova_config('api/metadata_cache_expiration').with('value' => '') is_expected.to contain_oslo__middleware('nova_config').with( :enable_proxy_headers_parsing => '',