Create a separate class for [retry_scheduler] parameters

This change adds an independent class for [retry_scheduler] parameters,
because these parameters are used not by the api service but the retry
daemon.

Currently no distro provides a package to install the service so
the new class only set parameters, which is incomplete. This will be
fixed once the packaging issue is resolved.

Change-Id: Ib8b649c2e5ac5fee5e5a3bd52caeb21780fc1f61
This commit is contained in:
Takashi Kajinami 2022-03-14 00:47:18 +09:00
parent 8166a080b9
commit 0d4580b27d
5 changed files with 108 additions and 26 deletions

View File

@ -120,14 +120,6 @@
# (optional) Server name for RPC service
# Defaults to $::os_service_default
#
# [*retry_scheduler_initial_delay_seconds*]
# (optional) Seconds (float) to wait before starting retry scheduler
# Defaults to $::os_service_default
#
# [*retry_scheduler_periodic_interval_max_seconds*]
# (optional) Seconds (float) to wait between starting retry scheduler
# Defaults to $::os_service_default
#
# [*enabled_secretstore_plugins*]
# (optional) Enabled secretstore plugins. Multiple plugins
# are defined in a list eg. ['store_crypto', dogtag_crypto']
@ -259,6 +251,16 @@
# (Optional) Default page size for the 'limit' paging URL parameter.
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
#
# [*retry_scheduler_initial_delay_seconds*]
# (optional) Seconds (float) to wait before starting retry scheduler
# Defaults to undef
#
# [*retry_scheduler_periodic_interval_max_seconds*]
# (optional) Seconds (float) to wait between starting retry scheduler
# Defaults to undef
#
class barbican::api (
$package_ensure = 'present',
$client_package_ensure = 'present',
@ -284,8 +286,6 @@ class barbican::api (
$queue_topic = $::os_service_default,
$queue_version = $::os_service_default,
$queue_server_name = $::os_service_default,
$retry_scheduler_initial_delay_seconds = $::os_service_default,
$retry_scheduler_periodic_interval_max_seconds = $::os_service_default,
$enabled_secretstore_plugins = $::os_service_default,
$enabled_crypto_plugins = $::os_service_default,
$enabled_secret_stores = 'simple_crypto',
@ -313,6 +313,9 @@ class barbican::api (
$max_request_body_size = $::os_service_default,
$max_limit_paging = $::os_service_default,
$default_limit_paging = $::os_service_default,
# DEPRECATED PARAMETERS
$retry_scheduler_initial_delay_seconds = undef,
$retry_scheduler_periodic_interval_max_seconds = undef,
) inherits barbican::params {
include barbican::deps
@ -388,12 +391,15 @@ class barbican::api (
'queue/server_name': value => $queue_server_name;
}
# retry scheduler and max allowed secret options
if $retry_scheduler_initial_delay_seconds != undef or $retry_scheduler_periodic_interval_max_seconds != undef {
warning('The retry_scheduler_* parameters are deprecated. Use barbican::retry_scheduler instead')
include barbican::retry_scheduler
}
# max allowed secret options
barbican_config {
'retry_scheduler/initial_delay_seconds': value => $retry_scheduler_initial_delay_seconds;
'retry_scheduler/periodic_interval_max_seconds': value => $retry_scheduler_periodic_interval_max_seconds;
'DEFAULT/max_allowed_secret_in_bytes': value => $max_allowed_secret_in_bytes;
'DEFAULT/max_allowed_request_size_in_bytes': value => $max_allowed_request_size_in_bytes;
'DEFAULT/max_allowed_secret_in_bytes': value => $max_allowed_secret_in_bytes;
'DEFAULT/max_allowed_request_size_in_bytes': value => $max_allowed_request_size_in_bytes;
}
if $multiple_secret_stores_enabled and !is_service_default($enabled_secretstore_plugins) {

View File

@ -0,0 +1,30 @@
# == Class: barbican::retry_scheduler
#
# Class to configure the retry scheduler service
#
# === Parameters
#
# [*initial_delay_seconds*]
# (optional) Seconds (float) to wait before starting retry scheduler
# Defaults to $::os_service_default
#
# [*periodic_interval_max_seconds*]
# (optional) Seconds (float) to wait between starting retry scheduler
# Defaults to $::os_service_default
#
class barbican::retry_scheduler (
$initial_delay_seconds = $::os_service_default,
$periodic_interval_max_seconds = $::os_service_default,
){
include barbican::params
barbican_config {
'retry_scheduler/initial_delay_seconds': value => $initial_delay_seconds;
'retry_scheduler/periodic_interval_max_seconds': value => $periodic_interval_max_seconds;
}
# TODO(tkajinam): Currently NO DISTRO provides the pachage to install
# the retry daemon service. Once that is fixed, install
# a separate package and enable the service.
}

View File

@ -0,0 +1,12 @@
---
features:
- |
The new ``barbican::retry_scheduler`` class has been added.
deprecations:
- |
The following parameters of the ``barbican`` class have been deprecated in
favor of the new ``barbican::retry_scheduler`` class.
- ``retry_scheduler_initial_delay_seconds``
- ``retry_scheduler_periodic_interval_max_seconds``

View File

@ -60,8 +60,6 @@ describe 'barbican::api' do
:enabled_certificate_plugins => ['<SERVICE DEFAULT>'],
:enabled_certificate_event_plugins => ['<SERVICE DEFAULT>'],
:auth_strategy => 'keystone',
:retry_scheduler_initial_delay_seconds => '<SERVICE DEFAULT>',
:retry_scheduler_periodic_interval_max_seconds => '<SERVICE DEFAULT>',
:service_name => platform_params[:service_name],
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
:max_request_body_size => '<SERVICE DEFAULT>',
@ -107,8 +105,6 @@ describe 'barbican::api' do
:enabled_crypto_plugins => ['simple_crypto'],
:enabled_certificate_plugins => ['simple_certificate', 'dogtag'],
:enabled_certificate_event_plugins => ['simple_certificate_event', 'foo_event'],
:retry_scheduler_initial_delay_seconds => 10,
:retry_scheduler_periodic_interval_max_seconds => 11,
:max_allowed_secret_in_bytes => 20000,
:max_allowed_request_size_in_bytes => 2000000,
:enable_proxy_headers_parsing => false,
@ -210,13 +206,6 @@ describe 'barbican::api' do
.with_value(param_hash[:multiple_secret_stores_enabled])
end
it 'configures retry scheduler' do
is_expected.to contain_barbican_config('retry_scheduler/initial_delay_seconds') \
.with_value(param_hash[:retry_scheduler_initial_delay_seconds])
is_expected.to contain_barbican_config('retry_scheduler/periodic_interval_max_seconds') \
.with_value(param_hash[:retry_scheduler_periodic_interval_max_seconds])
end
it 'resets the barbican_api pipeline' do
is_expected.to contain_barbican_api_paste_ini('pipeline:barbican_api/pipeline')\
.with_value('cors http_proxy_to_wsgi unauthenticated-context apiapp')

View File

@ -0,0 +1,45 @@
require 'spec_helper'
describe 'barbican::retry_scheduler' do
let :params do
{}
end
shared_examples 'barbican::retry_scheduler' do
context 'with defaults' do
it 'configures retry scheduler parameters' do
is_expected.to contain_barbican_config('retry_scheduler/initial_delay_seconds')\
.with_value('<SERVICE DEFAULT>')
is_expected.to contain_barbican_config('retry_scheduler/periodic_interval_max_seconds')\
.with_value('<SERVICE DEFAULT>')
end
end
context 'with parameters set' do
before do
params.merge!({
:initial_delay_seconds => 10,
:periodic_interval_max_seconds => 11,
})
end
it 'configures retry scheduler parameters' do
is_expected.to contain_barbican_config('retry_scheduler/initial_delay_seconds')\
.with_value(10)
is_expected.to contain_barbican_config('retry_scheduler/periodic_interval_max_seconds')\
.with_value(11)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
context "on #{os}" do
it_behaves_like 'barbican::retry_scheduler'
end
end
end