Browse Source

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: I1fe4c1eed71e9b4ca977b206edefbd0c700af74d
changes/96/728596/4
Takashi Kajinami 2 years ago
parent
commit
b046aa43ea
  1. 2
      manifests/db/mysql.pp
  2. 10
      manifests/db/postgresql.pp
  3. 4
      metadata.json
  4. 30
      spec/classes/aodh_db_mysql_spec.rb
  5. 11
      spec/classes/aodh_db_postgresql_spec.rb

2
manifests/db/mysql.pp

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

10
manifests/db/postgresql.pp

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

4
metadata.json

@ -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"

30
spec/classes/aodh_db_mysql_spec.rb

@ -11,49 +11,47 @@ describe 'aodh::db::mysql' do
let :params do
{
'password' => 'fooboozoo_default_password',
'password' => 'aodhpass',
}
end
shared_examples_for 'aodh::db::mysql' do
context 'with only required params' do
it { is_expected.to contain_openstacklib__db__mysql('aodh').with(
'user' => 'aodh',
'password_hash' => '*3DDF34A86854A312A8E2C65B506E21C91800D206',
'dbname' => 'aodh',
'host' => '127.0.0.1',
'charset' => 'utf8',
:collate => 'utf8_general_ci',
'user' => 'aodh',
'password' => 'aodhpass',
'dbname' => 'aodh',
'host' => '127.0.0.1',
'charset' => 'utf8',
:collate => 'utf8_general_ci',
)}
end
context "overriding allowed_hosts param to array" do
let :params do
{
:password => 'aodhpass',
:allowed_hosts => ['127.0.0.1','%']
:password => 'aodhpass',
:allowed_hosts => ['127.0.0.1','%']
}
end
end
context "overriding allowed_hosts param to string" do
let :params do
{
:password => 'aodhpass2',
:allowed_hosts => '192.168.1.1'
:password => 'aodhpass2',
:allowed_hosts => '192.168.1.1'
}
end
end
context "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'aodhpass2',
:allowed_hosts => '127.0.0.1'
:password => 'aodhpass2',
:allowed_hosts => '127.0.0.1'
}
end
end
end

11
spec/classes/aodh_db_postgresql_spec.rb

@ -3,7 +3,7 @@ require 'spec_helper'
describe 'aodh::db::postgresql' do
let :req_params do
{ :password => 'pw' }
{ :password => 'aodhpass' }
end
let :pre_condition do
@ -16,9 +16,12 @@ describe 'aodh::db::postgresql' do
req_params
end
it { is_expected.to contain_postgresql__server__db('aodh').with(
:user => 'aodh',
:password => 'md534e5dd092d680f3d8c11c62951fb5c19'
it { is_expected.to contain_openstacklib__db__postgresql('aodh').with(
:user => 'aodh',
:password => 'aodhpass',
:dbname => 'aodh',
:encoding => nil,
:privileges => 'ALL',
)}
end

Loading…
Cancel
Save