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: I96f0496889fe6fa349259689f2a46ac5e029c46d
This commit is contained in:
Takashi Kajinami 2020-05-20 08:35:22 +09:00
parent cc5c2e5198
commit ce663a7718
5 changed files with 34 additions and 35 deletions

View File

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

View File

@ -35,11 +35,11 @@ class watcher::db::postgresql(
include watcher::deps
::openstacklib::db::postgresql { 'watcher':
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['watcher::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/openstacklib",
"version_requirement": ">=16.3.0 <17.0.0"

View File

@ -7,7 +7,7 @@ describe 'watcher::db::mysql' do
end
let :required_params do
{ :password => 'fooboozoo_default_password', }
{ :password => 'watcherpass', }
end
shared_examples_for 'watcher-db-mysql' do
@ -17,12 +17,12 @@ describe 'watcher::db::mysql' do
end
it { is_expected.to contain_openstacklib__db__mysql('watcher').with(
:user => 'watcher',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'watcher',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:user => 'watcher',
:password => 'watcherpass',
:dbname => 'watcher',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
end
@ -32,13 +32,13 @@ describe 'watcher::db::mysql' do
end
it { is_expected.to contain_openstacklib__db__mysql('watcher').with(
:user => 'watcher',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'watcher',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => ['127.0.0.1','%']
:user => 'watcher',
:password => 'watcherpass',
:dbname => 'watcher',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => ['127.0.0.1','%']
)}
end
@ -48,13 +48,13 @@ describe 'watcher::db::mysql' do
end
it { is_expected.to contain_openstacklib__db__mysql('watcher').with(
:user => 'watcher',
:password_hash => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
:dbname => 'watcher',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '192.168.1.1'
:user => 'watcher',
:password => 'watcherpass',
:dbname => 'watcher',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '192.168.1.1'
)}
end
end

View File

@ -7,7 +7,7 @@ describe 'watcher::db::postgresql' do
end
let :required_params do
{ :password => 'pw' }
{ :password => 'watcherpass' }
end
shared_examples_for 'watcher-db-postgresql' do
@ -16,9 +16,12 @@ describe 'watcher::db::postgresql' do
required_params
end
it { is_expected.to contain_postgresql__server__db('watcher').with(
:user => 'watcher',
:password => 'md5bb8678c96047fcce9b899ad5da021642'
it { is_expected.to contain_openstacklib__db__postgresql('watcher').with(
:user => 'watcher',
:password => 'watcherpass',
:dbname => 'watcher',
:encoding => nil,
:privileges => 'ALL',
)}
end
end