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': openstacklib::db::mysql { 'barbican':
user => $user, user => $user,
password_hash => mysql::password($password), password => $password,
dbname => $dbname, dbname => $dbname,
host => $host, host => $host,
charset => $charset, charset => $charset,

View File

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

View File

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

View File

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

View File

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