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: Ifb49935c3ce49251aada5c78a89e825fa50610aa
This commit is contained in:
Tobias Urdin 2020-05-30 09:34:51 +02:00 committed by Takashi Kajinami
parent a12962ab24
commit d878511593
5 changed files with 23 additions and 23 deletions

View File

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

View File

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

View File

@ -9,10 +9,6 @@
"name": "puppetlabs/stdlib",
"version_requirement": ">=5.0.0 <7.0.0"
},
{
"name": "puppetlabs/mysql",
"version_requirement": ">=6.0.0 <9.0.0"
},
{
"name": "openstack/keystone",
"version_requirement": ">=14.1.0 <15.0.0"

View File

@ -7,7 +7,7 @@ describe '{{cookiecutter.project_name}}::db::mysql' do
let :required_params do
{
:password => 'fooboozoo_default_password'
:password => '{{cookiecutter.project_name}}pass'
}
end
@ -18,12 +18,12 @@ describe '{{cookiecutter.project_name}}::db::mysql' do
end
it { should contain_openstacklib__db__mysql('{{cookiecutter.project_name}}').with(
:user => '{{cookiecutter.project_name}}',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => '{{cookiecutter.project_name}}',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:user => '{{cookiecutter.project_name}}',
:password => '{{cookiecutter.project_name}}pass',
:dbname => '{{cookiecutter.project_name}}',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
end
@ -34,7 +34,7 @@ describe '{{cookiecutter.project_name}}::db::mysql' do
it { should contain_openstacklib__db__mysql('{{cookiecutter.project_name}}').with(
:user => '{{cookiecutter.project_name}}',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:password => '{{cookiecutter.project_name}}pass',
:dbname => '{{cookiecutter.project_name}}',
:host => '127.0.0.1',
:charset => 'utf8',
@ -50,7 +50,7 @@ describe '{{cookiecutter.project_name}}::db::mysql' do
it { should contain_openstacklib__db__mysql('{{cookiecutter.project_name}}').with(
:user => '{{cookiecutter.project_name}}',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:password => '{{cookiecutter.project_name}}pass',
:dbname => '{{cookiecutter.project_name}}',
:host => '127.0.0.1',
:charset => 'utf8',

View File

@ -7,7 +7,7 @@ describe '{{cookiecutter.project_name}}::db::postgresql' do
let :required_params do
{
:password => 'pw'
:password => '{{cookiecutter.project_name}}pass'
}
end
@ -17,9 +17,13 @@ describe '{{cookiecutter.project_name}}::db::postgresql' do
required_params
end
it { should contain_postgresql__server__db('{{cookiecutter.project_name}}').with(
:user => '{{cookiecutter.project_name}}',
:password => 'md5c530c33636c58ae83ca933f39319273e'
it { should contain_class('{{cookiecutter.project_name}}::deps') }
it { should contain_openstacklib__db__postgresql('{{cookiecutter.project_name}}').with(
:password => params[:password],
:dbname => '{{cookiecutter.project_name}}',
:user => '{{cookiecutter.project_name}}',
:privileges => 'ALL',
)}
end
end