Use oslo::db to set up api_database
Depends-on: https://review.opendev.org/#/c/749034/ Change-Id: I0a8a425226b3afd3686da69674a47bec238a6459
This commit is contained in:
parent
77ed829265
commit
121b289f7e
|
@ -129,15 +129,14 @@ class nova::db (
|
|||
}
|
||||
|
||||
if !is_service_default($api_database_connection_real) {
|
||||
|
||||
validate_legacy(Oslo::Dbconn, 'validate_re', $api_database_connection_real,
|
||||
['^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?'])
|
||||
|
||||
nova_config {
|
||||
'api_database/connection': value => $api_database_connection_real, secret => true;
|
||||
'api_database/slave_connection': value => $api_slave_connection_real, secret => true;
|
||||
oslo::db { 'api_database':
|
||||
config => 'nova_config',
|
||||
config_group => 'api_database',
|
||||
connection => $api_database_connection_real,
|
||||
slave_connection => $api_slave_connection_real,
|
||||
# Package management should be disabled here to avoid conflict.
|
||||
manage_backend_package => false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,8 +44,12 @@ describe 'nova::db' do
|
|||
:mysql_enable_ndb => '<SERVICE DEFAULT>',
|
||||
)}
|
||||
|
||||
it { should contain_nova_config('api_database/connection').with_value('mysql+pymysql://user:pass@db/db2').with_secret(true) }
|
||||
it { should contain_nova_config('api_database/slave_connection').with_value('mysql+pymysql://user:pass@slave/db2').with_secret(true) }
|
||||
it { should contain_oslo__db('api_database').with(
|
||||
:config => 'nova_config',
|
||||
:config_group => 'api_database',
|
||||
:connection => 'mysql+pymysql://user:pass@db/db2',
|
||||
:slave_connection => 'mysql+pymysql://user:pass@slave/db2',
|
||||
)}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue