Merge "Replace deprecated [coordination] heartbeat"

This commit is contained in:
Zuul 2021-11-17 04:55:32 +00:00 committed by Gerrit Code Review
commit e14e5f12f9
3 changed files with 31 additions and 6 deletions

View File

@ -8,7 +8,7 @@
# (Optional) Coordination backend URL.
# Defaults to $::os_service_default
#
# [*heartbeat*]
# [*heartbeat_interval*]
# (Optional) Number of seconds between hearbeats for distributed
# coordintation.
# Defaults to $::os_service_default
@ -23,24 +23,43 @@
# group
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
#
# [*heartbeat*]
# (Optional) Number of seconds between hearbeats for distributed
# coordintation.
# Defaults to undef
#
class aodh::coordination (
$backend_url = $::os_service_default,
$heartbeat = $::os_service_default,
$heartbeat_interval = $::os_service_default,
$retry_backoff = $::os_service_default,
$max_retry_interval = $::os_service_default,
# DEPRECATED PARAMETERS
$heartbeat = undef,
) {
include aodh::deps
$backend_url_real = pick($::aodh::evaluator::coordination_url, $backend_url)
if $heartbeat != undef {
warning('The heartbeat parmaeter is deprecated. Use the heartbeat_interval parameter instead')
}
$heartbeat_interval_real = pick($heartbeat, $heartbeat_interval)
oslo::coordination{ 'aodh_config':
backend_url => $backend_url_real
}
aodh_config {
'coordination/heartbeat': value => $heartbeat;
'coordination/heartbeat_interval': value => $heartbeat_interval_real;
'coordination/retry_backoff': value => $retry_backoff;
'coordination/max_retry_interval': value => $max_retry_interval;
}
# TODO(tkajinam): Remove this when the hearbeat parameter is removed.
aodh_config {
'coordination/heartbeat': ensure => absent;
}
}

View File

@ -0,0 +1,6 @@
---
deprecations:
- |
The ``aodh::coordination::heartbeat`` parameter has been deprecated. This
parameter is left to keep backword compatibility but will be fully
replaced by the new ``heartbeat_interval`` parameter.

View File

@ -7,7 +7,7 @@ describe 'aodh::coordination' do
is_expected.to contain_oslo__coordination('aodh_config').with(
:backend_url => '<SERVICE DEFAULT>'
)
is_expected.to contain_aodh_config('coordination/heartbeat').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('coordination/heartbeat_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('coordination/retry_backoff').with_value('<SERVICE DEFAULT>')
is_expected.to contain_aodh_config('coordination/max_retry_interval').with_value('<SERVICE DEFAULT>')
}
@ -17,7 +17,7 @@ describe 'aodh::coordination' do
let :params do
{
:backend_url => 'etcd3+http://127.0.0.1:2379',
:heartbeat => 1,
:heartbeat_interval => 1,
:retry_backoff => 1,
:max_retry_interval => 30,
}
@ -27,7 +27,7 @@ describe 'aodh::coordination' do
is_expected.to contain_oslo__coordination('aodh_config').with(
:backend_url => 'etcd3+http://127.0.0.1:2379'
)
is_expected.to contain_aodh_config('coordination/heartbeat').with_value(1)
is_expected.to contain_aodh_config('coordination/heartbeat_interval').with_value(1)
is_expected.to contain_aodh_config('coordination/retry_backoff').with_value(1)
is_expected.to contain_aodh_config('coordination/max_retry_interval').with_value(30)
}