Add support for the oslo db_max_retries parameter
The db_max_retries parameter regulates the number of reconnection attempts performed after an error raised rather than at startup. Change-Id: Ief8fe19b1b45cf275f35c05e044ebf226b835311 Closes-Bug: 1579718
This commit is contained in:
parent
aa2165e7d7
commit
366c0c47a2
|
@ -43,6 +43,11 @@
|
|||
# will be removed during a later release.
|
||||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
# [*database_db_max_retries*]
|
||||
# (Optional) Maximum retries in case of connection error or deadlock error
|
||||
# before error is raised. Set to -1 to specify an infinite retry count.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class barbican::db (
|
||||
$database_connection = 'sqlite:////var/lib/barbican/barbican.sqlite',
|
||||
$database_idle_timeout = $::os_service_default,
|
||||
|
@ -52,6 +57,7 @@ class barbican::db (
|
|||
$database_retry_interval = $::os_service_default,
|
||||
$database_max_overflow = $::os_service_default,
|
||||
$database_pool_size = $::os_service_default,
|
||||
$database_db_max_retries = $::os_service_default,
|
||||
) {
|
||||
|
||||
$database_connection_real = pick($::barbican::database_connection, $database_connection)
|
||||
|
@ -73,6 +79,7 @@ class barbican::db (
|
|||
max_retries => $database_max_retries_real,
|
||||
retry_interval => $database_retry_interval_real,
|
||||
max_overflow => $database_max_overflow_real,
|
||||
db_max_retries => $database_db_max_retries,
|
||||
}
|
||||
|
||||
# TODO(aschultz): Remove this config once barbican properly leverages oslo
|
||||
|
|
|
@ -11,6 +11,7 @@ describe 'barbican::db' do
|
|||
it { is_expected.to contain_barbican_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_barbican_config('database/max_retries').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_barbican_config('database/retry_interval').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_barbican_config('database/db_max_retries').with_value('<SERVICE DEFAULT>') }
|
||||
|
||||
# TODO(aschultz): remove once oslo is properly used
|
||||
it { is_expected.to contain_barbican_config('DEFAULT/sql_connection').with_value('sqlite:////var/lib/barbican/barbican.sqlite') }
|
||||
|
@ -29,6 +30,7 @@ describe 'barbican::db' do
|
|||
:database_retry_interval => '11',
|
||||
:database_max_overflow => '11',
|
||||
:database_pool_size => '2',
|
||||
:database_db_max_retries => '-1',
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -38,6 +40,7 @@ describe 'barbican::db' do
|
|||
it { is_expected.to contain_barbican_config('database/max_retries').with_value('11') }
|
||||
it { is_expected.to contain_barbican_config('database/retry_interval').with_value('11') }
|
||||
it { is_expected.to contain_barbican_config('database/max_overflow').with_value('11') }
|
||||
it { is_expected.to contain_barbican_config('database/db_max_retries').with_value('-1') }
|
||||
|
||||
# TODO(aschultz) remove once oslo is properly used
|
||||
it { is_expected.to contain_barbican_config('DEFAULT/sql_connection').with_value('mysql+pymysql://barbican:barbican@localhost/barbican').with_secret(true) }
|
||||
|
|
Loading…
Reference in New Issue