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: I814e6813ad8eab08e1228b85e428f9a479950781
This commit is contained in:
Takashi Kajinami 2020-05-20 08:13:18 +09:00
parent 953376d348
commit aefa219709
5 changed files with 26 additions and 28 deletions

View File

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

View File

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

@ -12,32 +12,32 @@ describe 'magnum::db::mysql' do
let :params do
{
'password' => 'secrete',
'password' => 'magnumpass',
}
end
context 'with only required params' do
it { is_expected.to contain_openstacklib__db__mysql('magnum').with(
:user => 'magnum',
:password_hash => '*FBA9D2346613CFE4A811FC2A4A648432C6FA2CFD',
:dbname => 'magnum',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:user => 'magnum',
:password => 'magnumpass',
:dbname => 'magnum',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
end
context "overriding allowed_hosts param to array" do
let :params do
{
:password => 'secrete',
:password => 'magnumpass',
:allowed_hosts => ['127.0.0.1','%'],
}
end
it { is_expected.to contain_openstacklib__db__mysql('magnum').with(
:user => 'magnum',
:password_hash => '*FBA9D2346613CFE4A811FC2A4A648432C6FA2CFD',
:password => 'magnumpass',
:dbname => 'magnum',
:host => '127.0.0.1',
:charset => 'utf8',
@ -50,14 +50,14 @@ describe 'magnum::db::mysql' do
context "overriding allowed_hosts param to string" do
let :params do
{
:password => 'secrete',
:password => 'magnumpass',
:allowed_hosts => '192.168.1.1',
}
end
it { is_expected.to contain_openstacklib__db__mysql('magnum').with(
:user => 'magnum',
:password_hash => '*FBA9D2346613CFE4A811FC2A4A648432C6FA2CFD',
:password => 'magnumpass',
:dbname => 'magnum',
:host => '127.0.0.1',
:charset => 'utf8',
@ -70,14 +70,14 @@ describe 'magnum::db::mysql' do
context "overriding allowed_hosts equal to host param" do
let :params do
{
:password => 'secrete',
:password => 'magnumpass',
:allowed_hosts => '127.0.0.1',
}
end
it { is_expected.to contain_openstacklib__db__mysql('magnum').with(
:user => 'magnum',
:password_hash => '*FBA9D2346613CFE4A811FC2A4A648432C6FA2CFD',
:password => 'magnumpass',
:dbname => 'magnum',
:host => '127.0.0.1',
:charset => 'utf8',

View File

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