Deprecate service validation for nova-api

Following the past deprecation in puppet-keystone[1], this change
deprecates service validation for nova-api.

[1] 3c95205e0253895e477b9135c10f5175d4166cfc

Change-Id: I6c409232f5b5120b93d1d47ffa416309d3d9d643
This commit is contained in:
Takashi Kajinami 2021-12-13 23:22:18 +09:00
parent 3142dc8cdd
commit 2476bd9af5
3 changed files with 27 additions and 72 deletions

View File

@ -79,26 +79,6 @@
# (Optional) Set max request body size
# Defaults to $::os_service_default.
#
# [*validate*]
# (optional) Whether to validate the service is working after any service refreshes
# Defaults to false
#
# [*validation_options*]
# (optional) Service validation options
# Should be a hash of options defined in openstacklib::service_validation
# If empty, defaults values are taken from openstacklib function.
# Default command list nova flavors.
# Require validate set at True.
# Example:
# nova::api::validation_options:
# nova-api:
# command: check_nova.py
# path: /usr/bin:/bin:/usr/sbin:/sbin
# provider: shell
# tries: 5
# try_sleep: 10
# Defaults to {}
#
# [*service_name*]
# (optional) Name of the service that will be providing the
# server functionality of nova-api.
@ -198,6 +178,18 @@
# (optional) The rate limiting factory to use
# Defaults to undef
#
# [*validate*]
# (optional) Whether to validate the service is working after any service refreshes
# Defaults to undef
#
# [*validation_options*]
# (optional) Service validation options
# Should be a hash of options defined in openstacklib::service_validation
# If empty, defaults values are taken from openstacklib function.
# Default command list nova flavors.
# Require validate set at True.
# Defaults to undef
#
class nova::api(
$enabled = true,
$manage_service = true,
@ -214,8 +206,6 @@ class nova::api(
$sync_db = true,
$sync_db_api = true,
$db_online_data_migrations = false,
$validate = false,
$validation_options = {},
$instance_name_template = $::os_service_default,
$service_name = $::nova::params::api_service_name,
$metadata_service_name = $::nova::params::api_metadata_service_name,
@ -239,6 +229,8 @@ class nova::api(
$install_cinder_client = undef,
$ratelimits = undef,
$ratelimits_factory = undef,
$validate = undef,
$validation_options = undef,
) inherits nova::params {
include nova::deps
@ -260,6 +252,13 @@ class nova::api(
warning('The nova::api::ratelimits parameter has been deprecated and has no effect')
}
if $validate != undef {
warning('The nova::api::validate parameter has been deprecated and has no effect')
}
if $validation_options != undef {
warning('The nova::api::validation_options parameter has been deprecated and has no effect')
}
if $instance_name_template {
$instance_name_template_real = $instance_name_template
} else {
@ -373,27 +372,4 @@ as a standalone service, or httpd for being run by a httpd server")
if $db_online_data_migrations {
include nova::db::online_data_migrations
}
if $validate {
$authtoken_values = {
'username' => $::nova::keystone::authtoken::username,
'password' => $::nova::keystone::authtoken::password,
'project_name' => $::nova::keystone::authtoken::project_name,
'www_authenticate_uri' => $::nova::keystone::authtoken::www_authenticate_uri,
}
$authtoken = merge($authtoken_values, $::nova::keystone::authtoken::params)
$defaults = {
'nova-api' => {
'command' => @("CMD"/L)
nova --os-auth-url ${authtoken['www_authenticate_uri']} \
--os-project-name ${authtoken['project_name']} \
--os-username ${authtoken['username']} \
--os-password ${authtoken['password']} \
flavor-list
|- CMD
}
}
$validation_options_hash = merge ($defaults, $validation_options)
create_resources('openstacklib::service_validation', $validation_options_hash, {'subscribe' => 'Anchor[nova::service::end]'})
}
}

View File

@ -0,0 +1,6 @@
---
deprecations:
- |
The service validation feature of the ``nova::api`` class is deprecated,
and the ``nova::api::validate`` parameter and
the ``nova::api::validate_options`` parameter have no effect now.

View File

@ -35,7 +35,6 @@ describe 'nova::api' do
)
is_expected.to contain_package('nova-api').that_requires('Anchor[nova::install::begin]')
is_expected.to contain_package('nova-api').that_notifies('Anchor[nova::install::end]')
is_expected.to_not contain_exec('validate_nova_api')
end
it 'enable metadata in evenlet configuration' do
@ -147,32 +146,6 @@ describe 'nova::api' do
end
end
context 'while validating the service with default command' do
before do
params.merge!({
:validate => true,
})
end
it { is_expected.to contain_openstacklib__service_validation('nova-api').with(
:command => 'nova --os-auth-url http://127.0.0.1:5000/ --os-project-name services --os-username novae --os-password passw0rd flavor-list',
:subscribe => 'Anchor[nova::service::end]',
)}
end
context 'while validating the service with custom command' do
before do
params.merge!({
:validate => true,
:validation_options => { 'nova-api' => { 'command' => 'my-script' } }
})
end
it { is_expected.to contain_openstacklib__service_validation('nova-api').with(
:command => 'my-script',
:subscribe => 'Anchor[nova::service::end]',
)}
end
context 'while not managing service state' do
before do
params.merge!({