Browse Source

Added missing slave_connection param

Slave_connection was available in main class, but it doesn't
configure service correctly.

Change-Id: I7a585c5481b80e5e0d12ad97271632c2abada1c1
changes/13/584313/2
Daniel Pawlik 4 years ago
parent
commit
fb8128d0db
  1. 25
      manifests/db.pp
  2. 20
      spec/classes/aodh_db_spec.rb

25
manifests/db.pp

@ -13,6 +13,10 @@
# Url used to connect to database.
# (Optional) Defaults to "sqlite:////var/lib/aodh/aodh.sqlite".
#
# [*slave_connection*]
# (optional) Connection url to connect to aodh slave database (read-only).
# Defaults to $::os_service_default.
#
# [*database_idle_timeout*]
# Timeout when db connections should be reaped.
# (Optional) Defaults to $::os_service_default.
@ -45,6 +49,7 @@
class aodh::db (
$database_db_max_retries = $::os_service_default,
$database_connection = 'sqlite:////var/lib/aodh/aodh.sqlite',
$slave_connection = $::os_service_default,
$database_idle_timeout = $::os_service_default,
$database_min_pool_size = $::os_service_default,
$database_max_pool_size = $::os_service_default,
@ -57,6 +62,7 @@ class aodh::db (
include ::aodh::deps
$database_connection_real = pick($::aodh::database_connection, $database_connection)
$slave_connection_real = pick($::aodh::slave_connection, $slave_connection)
$database_idle_timeout_real = pick($::aodh::database_idle_timeout, $database_idle_timeout)
$database_min_pool_size_real = pick($::aodh::database_min_pool_size, $database_min_pool_size)
$database_max_pool_size_real = pick($::aodh::database_max_pool_size, $database_max_pool_size)
@ -65,14 +71,15 @@ class aodh::db (
$database_max_overflow_real = pick($::aodh::database_max_overflow, $database_max_overflow)
oslo::db { 'aodh_config':
db_max_retries => $database_db_max_retries,
connection => $database_connection_real,
idle_timeout => $database_idle_timeout_real,
min_pool_size => $database_min_pool_size_real,
max_pool_size => $database_max_pool_size_real,
max_retries => $database_max_retries_real,
retry_interval => $database_retry_interval_real,
max_overflow => $database_max_overflow_real,
pool_timeout => $database_pool_timeout,
db_max_retries => $database_db_max_retries,
connection => $database_connection_real,
slave_connection => $slave_connection_real,
idle_timeout => $database_idle_timeout_real,
min_pool_size => $database_min_pool_size_real,
max_pool_size => $database_max_pool_size_real,
max_retries => $database_max_retries_real,
retry_interval => $database_retry_interval_real,
max_overflow => $database_max_overflow_real,
pool_timeout => $database_pool_timeout,
}
}

20
spec/classes/aodh_db_spec.rb

@ -23,6 +23,7 @@ describe 'aodh::db' do
let :params do
{ :database_db_max_retries => '-1',
:database_connection => 'mysql+pymysql://aodh:aodh@localhost/aodh',
:slave_connection => 'mysql+pymysql://aodh:aodh@localhost2/aodh',
:database_idle_timeout => '3601',
:database_min_pool_size => '2',
:database_max_pool_size => '11',
@ -33,15 +34,16 @@ describe 'aodh::db' do
}
end
it { is_expected.to contain_oslo__db('aodh_config').with(
:db_max_retries => '-1',
:connection => 'mysql+pymysql://aodh:aodh@localhost/aodh',
:idle_timeout => '3601',
:min_pool_size => '2',
:max_pool_size => '11',
:max_retries => '11',
:retry_interval => '11',
:max_overflow => '21',
:pool_timeout => '21',
:db_max_retries => '-1',
:connection => 'mysql+pymysql://aodh:aodh@localhost/aodh',
:slave_connection => 'mysql+pymysql://aodh:aodh@localhost2/aodh',
:idle_timeout => '3601',
:min_pool_size => '2',
:max_pool_size => '11',
:max_retries => '11',
:retry_interval => '11',
:max_overflow => '21',
:pool_timeout => '21',
)}
end

Loading…
Cancel
Save