Make database parameters match upstream
Updates the database parameters to actually match what upstream barbican uses in its config file: http://git.openstack.org/cgit/openstack/barbican/tree/etc/barbican/barbican.conf#n41 Without these changes I get db sync failures w/ barbican when using MySQL. Change-Id: Ia79f3d1bed0c2a66ed17ae2ee91ca70c73f6c434 Co-Authored-By: Alex Schultz <aschultz@mirantis.com>
This commit is contained in:
parent
406cd9d6ca
commit
aa2165e7d7
|
@ -15,24 +15,34 @@
|
|||
# [*database_max_retries*]
|
||||
# Maximum number of database connection retries during startup.
|
||||
# Setting -1 implies an infinite retry count.
|
||||
# NOTE: This is currently NOT used until barbican correctly leverages oslo.
|
||||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
# [*database_retry_interval*]
|
||||
# Interval between retries of opening a database connection.
|
||||
# NOTE: This is currently NOT used until barbican correctly leverages oslo.
|
||||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
# [*database_min_pool_size*]
|
||||
# Minimum number of SQL connections to keep open in a pool.
|
||||
# NOTE: This is currently NOT used until barbican correctly leverages oslo.
|
||||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
# [*database_max_pool_size*]
|
||||
# Maximum number of SQL connections to keep open in a pool.
|
||||
# NOTE: This is currently NOT used until barbican correctly leverages oslo.
|
||||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
# [*database_max_overflow*]
|
||||
# If set, use this value for max_overflow with sqlalchemy.
|
||||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
# [*database_pool_size*]
|
||||
# Number of SQL connections to keep open in a pool.
|
||||
# NOTE: This is currently used until barbican correctly leverages oslo and
|
||||
# will be removed during a later release.
|
||||
# (Optional) Defaults to $::os_service_default
|
||||
#
|
||||
class barbican::db (
|
||||
$database_connection = 'sqlite:////var/lib/barbican/barbican.sqlite',
|
||||
$database_idle_timeout = $::os_service_default,
|
||||
|
@ -41,6 +51,7 @@ class barbican::db (
|
|||
$database_max_retries = $::os_service_default,
|
||||
$database_retry_interval = $::os_service_default,
|
||||
$database_max_overflow = $::os_service_default,
|
||||
$database_pool_size = $::os_service_default,
|
||||
) {
|
||||
|
||||
$database_connection_real = pick($::barbican::database_connection, $database_connection)
|
||||
|
@ -64,4 +75,13 @@ class barbican::db (
|
|||
max_overflow => $database_max_overflow_real,
|
||||
}
|
||||
|
||||
# TODO(aschultz): Remove this config once barbican properly leverages oslo
|
||||
$database_pool_size_real = pick($::barbican::database_pool_size, $database_pool_size)
|
||||
barbican_config {
|
||||
'DEFAULT/sql_connection': value => $database_connection_real, secret => true;
|
||||
'DEFAULT/sql_idle_timeout': value => $database_idle_timeout_real;
|
||||
'DEFAULT/sql_pool_size': value => $database_pool_size_real;
|
||||
'DEFAULT/sql_pool_max_overflow': value => $database_max_overflow_real;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ class barbican::db::sync(
|
|||
path => '/usr/bin',
|
||||
user => 'barbican',
|
||||
refreshonly => true,
|
||||
subscribe => [Package['barbican-api'], Barbican_config['database/connection']],
|
||||
subscribe => [Package['barbican-api'], Barbican_config['database/connection'], Barbican_config['DEFAULT/sql_connection'], ]
|
||||
}
|
||||
|
||||
Exec['barbican-db-manage'] ~> Service<| title == 'barbican-api' |>
|
||||
|
|
|
@ -12,6 +12,12 @@ describe 'barbican::db' do
|
|||
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>') }
|
||||
|
||||
# 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') }
|
||||
it { is_expected.to contain_barbican_config('DEFAULT/sql_idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_barbican_config('DEFAULT/sql_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_barbican_config('DEFAULT/sql_pool_max_overflow').with_value('<SERVICE DEFAULT>') }
|
||||
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
|
@ -21,6 +27,8 @@ describe 'barbican::db' do
|
|||
:database_min_pool_size => '2',
|
||||
:database_max_retries => '11',
|
||||
:database_retry_interval => '11',
|
||||
:database_max_overflow => '11',
|
||||
:database_pool_size => '2',
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -29,7 +37,13 @@ describe 'barbican::db' do
|
|||
it { is_expected.to contain_barbican_config('database/min_pool_size').with_value('2') }
|
||||
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') }
|
||||
|
||||
# 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) }
|
||||
it { is_expected.to contain_barbican_config('DEFAULT/sql_idle_timeout').with_value('3601') }
|
||||
it { is_expected.to contain_barbican_config('DEFAULT/sql_pool_size').with_value('2') }
|
||||
it { is_expected.to contain_barbican_config('DEFAULT/sql_pool_max_overflow').with_value('11') }
|
||||
end
|
||||
|
||||
context 'with postgresql backend' do
|
||||
|
|
Loading…
Reference in New Issue