diff --git a/manifests/api.pp b/manifests/api.pp index b876e2ea5..a351f789c 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -55,7 +55,7 @@ # # [*instance_name_template*] # (optional) Template string to be used to generate instance names -# Defaults to undef +# Defaults to $::os_service_default # # [*sync_db*] # (optional) Run nova-manage db sync on api nodes after installing the package. @@ -199,7 +199,7 @@ class nova::api( 'nova.api.openstack.compute.limits:RateLimitingMiddleware.factory', $validate = false, $validation_options = {}, - $instance_name_template = undef, + $instance_name_template = $::os_service_default, $service_name = $::nova::params::api_service_name, $metadata_service_name = $::nova::params::api_metadata_service_name, $enable_proxy_headers_parsing = $::os_service_default, @@ -235,13 +235,13 @@ class nova::api( } if $instance_name_template { - nova_config { - 'DEFAULT/instance_name_template': value => $instance_name_template; - } + $instance_name_template_real = $instance_name_template } else { - nova_config{ - 'DEFAULT/instance_name_template': ensure => absent; - } + warning('Using a false value for instance_name_template is deprecated. Use $::os_service_default instead.') + $instance_name_template_real = $::os_service_default + } + nova_config { + 'DEFAULT/instance_name_template': value => $instance_name_template_real; } # enable metadata in eventlet if we do not run metadata via wsgi (nova::metadata) diff --git a/releasenotes/notes/nova-api-instance_name_template-default-01fb4a333ff60e19.yaml b/releasenotes/notes/nova-api-instance_name_template-default-01fb4a333ff60e19.yaml new file mode 100644 index 000000000..b418aa608 --- /dev/null +++ b/releasenotes/notes/nova-api-instance_name_template-default-01fb4a333ff60e19.yaml @@ -0,0 +1,8 @@ +--- +deprecations: + - | + Default value of ``nova::api::instance_name_template`` has been changed + from ``undef`` to ``$::os_service_default``. The parameter still accepts + any false value then unsets the parameter, but this behavior will be + changed in a future release. Use ``$::os_service_default`` if you want to + use the default defined in nova implementation. diff --git a/spec/classes/nova_api_spec.rb b/spec/classes/nova_api_spec.rb index 5bfb99a0d..488806aa4 100644 --- a/spec/classes/nova_api_spec.rb +++ b/spec/classes/nova_api_spec.rb @@ -43,11 +43,11 @@ describe 'nova::api' do is_expected.to contain_nova_config('DEFAULT/enabled_apis').with_value('osapi_compute,metadata') end - it { is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_ensure('absent')} it { is_expected.to contain_class('nova::availability_zone') } it 'configures various stuff' do + is_expected.to contain_nova_config('DEFAULT/instance_name_template').with('value' => '') is_expected.to contain_nova_config('wsgi/api_paste_config').with('value' => 'api-paste.ini') is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '0.0.0.0') is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen_port').with('value' => '8774')