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: Ia676438c5c91da73a9fe196baaff9170991c487a
This commit is contained in:
Takashi Kajinami 2020-05-17 21:11:41 +09:00
parent 62238dba38
commit 5e5ced641f
5 changed files with 21 additions and 24 deletions

View File

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

View File

@ -35,11 +35,11 @@ class barbican::db::postgresql(
include barbican::deps
openstacklib::db::postgresql { 'barbican':
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['barbican::db::begin']

View File

@ -13,10 +13,6 @@
"name": "puppet/rabbitmq",
"version_requirement": ">=8.4.0 <11.0.0"
},
{
"name": "puppetlabs/mysql",
"version_requirement": ">=6.0.0 <11.0.0"
},
{
"name": "openstack/keystone",
"version_requirement": ">=16.3.0 <17.0.0"

View File

@ -31,18 +31,18 @@ describe 'barbican::db::mysql' do
let :params do
{
'password' => 'fooboozoo_default_password',
'password' => 'barbicanpass',
}
end
describe 'with only required params' do
it { is_expected.to contain_openstacklib__db__mysql('barbican').with(
'user' => 'barbican',
'password_hash' => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
'dbname' => 'barbican',
'host' => '127.0.0.1',
'charset' => 'utf8',
:collate => 'utf8_general_ci',
'user' => 'barbican',
'password' => 'barbicanpass',
'dbname' => 'barbican',
'host' => '127.0.0.1',
'charset' => 'utf8',
:collate => 'utf8_general_ci',
)}
end
@ -53,8 +53,8 @@ describe 'barbican::db::mysql' do
:allowed_hosts => ['127.0.0.1','%']
}
end
end
describe "overriding allowed_hosts param to string" do
let :params do
{
@ -62,7 +62,6 @@ describe 'barbican::db::mysql' do
:allowed_hosts => '192.168.1.1'
}
end
end
describe "overriding allowed_hosts param equals to host param " do
@ -72,7 +71,6 @@ describe 'barbican::db::mysql' do
:allowed_hosts => '127.0.0.1'
}
end
end
end

View File

@ -23,7 +23,7 @@ describe 'barbican::db::postgresql' do
shared_examples_for 'barbican::db::postgresql' do
let :req_params do
{ :password => 'pw' }
{ :password => 'barbicanpass' }
end
let :pre_condition do
@ -35,9 +35,12 @@ describe 'barbican::db::postgresql' do
req_params
end
it { is_expected.to contain_postgresql__server__db('barbican').with(
:user => 'barbican',
:password => 'md5699e09b3c7579f59869b882716fd7299'
it { is_expected.to contain_openstacklib__db__postgresql('barbican').with(
:user => 'barbican',
:password => 'barbicanpass',
:dbname => 'barbican',
:encoding => nil,
:privileges => 'ALL',
)}
end