Remove password hash generation in each puppet modules

... and migrate it to openstacklib so that all logics about database
configuration are implemented in one common place.

Depends-on: https://review.opendev.org/#/c/728595/
Change-Id: If86aa7d3bbf65ef322cbb3ec7c175edabaf95ebb
This commit is contained in:
Takashi Kajinami 2020-05-20 08:32:34 +09:00
parent 4c0f190721
commit d0233e468c
5 changed files with 41 additions and 42 deletions

View File

@ -49,7 +49,7 @@ class vitrage::db::mysql(
::openstacklib::db::mysql { 'vitrage':
user => $user,
password_hash => mysql::password($password),
password => $password,
dbname => $dbname,
host => $host,
charset => $charset,

View File

@ -35,11 +35,11 @@ class vitrage::db::postgresql(
include vitrage::deps
::openstacklib::db::postgresql { 'vitrage':
password_hash => postgresql_password($user, $password),
dbname => $dbname,
user => $user,
encoding => $encoding,
privileges => $privileges,
password => $password,
dbname => $dbname,
user => $user,
encoding => $encoding,
privileges => $privileges,
}
Anchor['vitrage::db::begin']

View File

@ -55,10 +55,6 @@
"name": "puppetlabs/stdlib",
"version_requirement": ">= 5.0.0 <7.0.0"
},
{
"name": "puppetlabs/mysql",
"version_requirement": ">=6.0.0 <11.0.0"
},
{
"name": "openstack/openstacklib",
"version_requirement": ">=16.3.0 <17.0.0"

View File

@ -13,36 +13,36 @@ describe 'vitrage::db::mysql' do
context 'with only required params' do
let :params do
{
'password' => 'fooboozoo_default_password',
'password' => 'vitragepass',
}
end
it { is_expected.to contain_openstacklib__db__mysql('vitrage').with(
:user => 'vitrage',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'vitrage',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:user => 'vitrage',
:password => 'vitragepass',
:dbname => 'vitrage',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
end
context "overriding allowed_hosts param to array" do
let :params do
{
:password => 'fooboozoo_default_password',
:allowed_hosts => ['127.0.0.1','%'],
:password => 'vitragepass',
:allowed_hosts => ['127.0.0.1','%'],
}
end
it { is_expected.to contain_openstacklib__db__mysql('vitrage').with(
:user => 'vitrage',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'vitrage',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => ['127.0.0.1','%'],
:user => 'vitrage',
:password => 'vitragepass',
:dbname => 'vitrage',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => ['127.0.0.1','%'],
)}
end
@ -50,19 +50,19 @@ describe 'vitrage::db::mysql' do
context "overriding allowed_hosts param to string" do
let :params do
{
:password => 'fooboozoo_default_password',
:allowed_hosts => '192.168.1.1',
:password => 'vitragepass',
:allowed_hosts => '192.168.1.1',
}
end
it { is_expected.to contain_openstacklib__db__mysql('vitrage').with(
:user => 'vitrage',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'vitrage',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '192.168.1.1',
:user => 'vitrage',
:password => 'vitragepass',
:dbname => 'vitrage',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '192.168.1.1',
)}
end
@ -70,14 +70,14 @@ describe 'vitrage::db::mysql' do
context "overriding allowed_hosts equal to host param" do
let :params do
{
:password => 'fooboozoo_default_password',
:password => 'vitragepass',
:allowed_hosts => '127.0.0.1',
}
end
it { is_expected.to contain_openstacklib__db__mysql('vitrage').with(
:user => 'vitrage',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:password => 'vitragepass',
:dbname => 'vitrage',
:host => '127.0.0.1',
:charset => 'utf8',
@ -89,7 +89,7 @@ describe 'vitrage::db::mysql' do
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do

View File

@ -4,7 +4,7 @@ describe 'vitrage::db::postgresql' do
shared_examples_for 'vitrage::db::postgresql' do
let :req_params do
{ :password => 'pw' }
{ :password => 'vitragepass' }
end
let :pre_condition do
@ -16,9 +16,12 @@ describe 'vitrage::db::postgresql' do
req_params
end
it { is_expected.to contain_postgresql__server__db('vitrage').with(
:user => 'vitrage',
:password => 'md58e3c14dceaf5be55c5982764df87003a'
it { is_expected.to contain_openstacklib__db__postgresql('vitrage').with(
:user => 'vitrage',
:password => 'vitragepass',
:dbname => 'vitrage',
:encoding => nil,
:privileges => 'ALL',
)}
end