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: I952e990e1f56d6e0226eac25397ab3062074551f
This commit is contained in:
Takashi Kajinami 2020-05-19 21:51:56 +09:00
parent f2acb11eb6
commit 8a733cddad
5 changed files with 23 additions and 24 deletions

View File

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

View File

@ -37,11 +37,11 @@ class trove::db::postgresql(
validate_legacy(String, 'validate_string', $password)
::openstacklib::db::postgresql { 'trove':
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['trove::db::begin']

View File

@ -17,10 +17,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/openstacklib",
"version_requirement": ">=16.3.0 <17.0.0"

View File

@ -27,12 +27,12 @@ describe 'trove::db::mysql' do
end
let :params do
{ :dbname => 'trove',
:password => 's3cr3t',
:user => 'trove',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:host => '127.0.0.1',
{ :dbname => 'trove',
:password => 'trovepass',
:user => 'trove',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:host => '127.0.0.1',
}
end
@ -47,7 +47,7 @@ describe 'trove::db::mysql' do
is_expected.to contain_openstacklib__db__mysql('trove').with(
:user => params[:user],
:dbname => params[:dbname],
:password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
:password => params[:password],
:host => params[:host],
:charset => params[:charset]
)
@ -56,7 +56,7 @@ describe 'trove::db::mysql' do
context 'overriding allowed_hosts param to array' do
before :each do
params.merge!(
:allowed_hosts => ['127.0.0.1','%']
:allowed_hosts => ['127.0.0.1','%']
)
end
@ -64,7 +64,7 @@ describe 'trove::db::mysql' do
is_expected.to contain_openstacklib__db__mysql('trove').with(
:user => params[:user],
:dbname => params[:dbname],
:password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
:password => params[:password],
:host => params[:host],
:charset => params[:charset],
:allowed_hosts => ['127.0.0.1','%']
@ -82,7 +82,7 @@ describe 'trove::db::mysql' do
is_expected.to contain_openstacklib__db__mysql('trove').with(
:user => params[:user],
:dbname => params[:dbname],
:password_hash => '*58C036CDA51D8E8BBBBF2F9EA5ABF111ADA444F0',
:password => params[:password],
:host => params[:host],
:charset => params[:charset],
:allowed_hosts => '192.168.1.1'

View File

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