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: Ie333f46508df1855dea70a32e3401bb4a5c8d4f3
This commit is contained in:
Takashi Kajinami 2020-05-19 19:39:53 +09:00
parent 6b66592c4c
commit 08666039b3
5 changed files with 26 additions and 28 deletions

View File

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

View File

@ -35,11 +35,11 @@ class cinder::db::postgresql(
include cinder::deps
::openstacklib::db::postgresql { 'cinder':
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['cinder::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": "puppetlabs/stdlib",
"version_requirement": ">=5.0.0 <7.0.0"

View File

@ -3,7 +3,7 @@ require 'spec_helper'
describe 'cinder::db::mysql' do
let :req_params do
{
:password => 'pw',
:password => 'cinderpass',
}
end
@ -18,25 +18,25 @@ describe 'cinder::db::mysql' do
end
it { is_expected.to contain_openstacklib__db__mysql('cinder').with(
:user => 'cinder',
:password_hash => '*D821809F681A40A6E379B50D0463EFAE20BDD122',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:user => 'cinder',
:password => 'cinderpass',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
end
context "overriding allowed_hosts param to array" do
let :params do
{
:password => 'cinderpass',
:allowed_hosts => ['127.0.0.1','%']
:password => 'cinderpass',
:allowed_hosts => ['127.0.0.1','%']
}
end
it { is_expected.to contain_openstacklib__db__mysql('cinder').with(
:user => 'cinder',
:password_hash => '*1C8A189441ED992638DD234B6711CD5064DA8C6E',
:password => 'cinderpass',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
@ -47,14 +47,14 @@ describe 'cinder::db::mysql' do
context "overriding allowed_hosts param to string" do
let :params do
{
:password => 'cinderpass2',
:allowed_hosts => '192.168.1.1'
:password => 'cinderpass2',
:allowed_hosts => '192.168.1.1'
}
end
it { is_expected.to contain_openstacklib__db__mysql('cinder').with(
:user => 'cinder',
:password_hash => '*0E9E710049E74D36D29D615DFC55F3FFD45413BC',
:password => 'cinderpass2',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
@ -72,7 +72,7 @@ describe 'cinder::db::mysql' do
it { is_expected.to contain_openstacklib__db__mysql('cinder').with(
:user => 'cinder',
:password_hash => '*0E9E710049E74D36D29D615DFC55F3FFD45413BC',
:password => 'cinderpass2',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',

View File

@ -3,7 +3,7 @@ require 'spec_helper'
describe 'cinder::db::postgresql' do
shared_examples 'cinder::db::postgresql' do
let :req_params do
{ :password => 'pw' }
{ :password => 'cinderpass' }
end
let :pre_condition do
@ -15,12 +15,14 @@ describe 'cinder::db::postgresql' do
req_params
end
it { is_expected.to contain_postgresql__server__db('cinder').with(
:user => 'cinder',
:password => 'md506736c3030793e09882cc536063d433f'
it { is_expected.to contain_openstacklib__db__postgresql('cinder').with(
:user => 'cinder',
:password => 'cinderpass',
:dbname => 'cinder',
:encoding => nil,
:privileges => 'ALL',
)}
end
end
on_supported_os({