Deprecate service validation for glance-api

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

[1] 3c95205e0253895e477b9135c10f5175d4166cfc

Change-Id: Icf44d49d68a345b0ac910918a3b4208e1c23aec9
This commit is contained in:
Takashi Kajinami 2021-12-13 23:25:29 +09:00
parent 3a2899ddfb
commit f3754c8c1f
3 changed files with 29 additions and 67 deletions

View File

@ -225,26 +225,6 @@
# (Optional) Run db sync on the node.
# Defaults to true
#
# [*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 images.
# Require validate set at True.
# Example:
# glance::api::validation_options:
# glance-api:
# command: check_glance-api.py
# path: /usr/bin:/bin:/usr/sbin:/sbin
# provider: shell
# tries: 5
# try_sleep: 10
# Defaults to {}
#
# [*limit_param_default*]
# (optional) Default value for the number of items returned by a request if not
# specified explicitly in the request (integer value)
@ -324,6 +304,19 @@
# http://auth_url:5000/v3
# 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 images.
# Require validate set at True.
# Example:
# Defaults to undef
#
class glance::api(
$package_ensure = 'present',
$bind_host = $::os_service_default,
@ -376,8 +369,6 @@ class glance::api(
$enable_proxy_headers_parsing = $::os_service_default,
$max_request_body_size = $::os_service_default,
$sync_db = true,
$validate = false,
$validation_options = {},
$limit_param_default = $::os_service_default,
$api_limit_max = $::os_service_default,
# DEPRECATED PARAMETERS
@ -396,6 +387,8 @@ class glance::api(
$keymgr_backend = undef,
$keymgr_encryption_api_url = undef,
$keymgr_encryption_auth_url = undef,
$validate = undef,
$validation_options = undef,
) inherits glance {
include glance::deps
@ -438,6 +431,14 @@ removed in a future realse. Use glance::api::db::database_retry_interval instead
removed in a future realse. Use glance::api::db::database_max_overflow instead')
}
if $validate != undef {
warning('The glance::api::validate parameter has been deprecated and has no effect')
}
if $validation_options != undef {
warning('The glance::api::validation_options parameter has been deprecated and has no effect')
}
if $sync_db {
include glance::db::sync
include glance::db::metadefs
@ -676,21 +677,4 @@ enabled_backends instead.')
tag => 'glance-service',
}
}
if $validate {
$keystone_project_name = $::glance::api::authtoken::project_name
$keystone_username = $::glance::api::authtoken::username
$keystone_password = $::glance::api::authtoken::password
$auth_url = $::glance::api::authtoken::www_authenticate_uri
$defaults = {
'glance-api' => {
# lint:ignore:140chars
'command' => "glance --os-auth-url ${auth_url} --os-project-name ${keystone_project_name} --os-username ${keystone_username} --os-password ${keystone_password} image-list",
# lint:endignore
}
}
$validation_options_hash = merge ($defaults, $validation_options)
create_resources('openstacklib::service_validation', $validation_options_hash, {'subscribe' => 'Service[glance-api]'})
}
}

View File

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

View File

@ -127,7 +127,6 @@ describe 'glance::api' do
'tag' => 'glance-service',
) }
it { is_expected.to_not contain_openstacklib__service_validation('glance-api') }
it { is_expected.to contain_glance_api_config("paste_deploy/flavor").with_value(param_hash[:pipeline]) }
it 'is_expected.to lay down default api config' do
@ -480,33 +479,6 @@ describe 'glance::api' do
end
end
describe 'while validating the service with default command' do
let :params do
default_params.merge({
:validate => true,
})
end
it { is_expected.to contain_openstacklib__service_validation('glance-api').with(
:command => 'glance --os-auth-url http://127.0.0.1:5000 --os-project-name services --os-username glance --os-password ChangeMe image-list',
:subscribe => 'Service[glance-api]',
)}
end
describe 'while validating the service with custom command' do
let :params do
default_params.merge({
:validate => true,
:validation_options => { 'glance-api' => { 'command' => 'my-script' } }
})
end
it { is_expected.to contain_openstacklib__service_validation('glance-api').with(
:command => 'my-script',
:subscribe => 'Service[glance-api]',
)}
end
describe 'with barbican parameters' do
let :params do
default_params.merge!({