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: I7a1ef6c25871b993279413c6bbfbee38838eb4d9
This commit is contained in:
parent
76a880860f
commit
7244048a70
@ -46,7 +46,7 @@ class neutron::db::mysql (
|
||||
|
||||
::openstacklib::db::mysql { 'neutron':
|
||||
user => $user,
|
||||
password_hash => mysql::password($password),
|
||||
password => $password,
|
||||
dbname => $dbname,
|
||||
host => $host,
|
||||
charset => $charset,
|
||||
|
@ -35,11 +35,11 @@ class neutron::db::postgresql(
|
||||
include neutron::deps
|
||||
|
||||
::openstacklib::db::postgresql { 'neutron':
|
||||
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['neutron::db::begin']
|
||||
|
@ -9,10 +9,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"
|
||||
|
@ -7,32 +7,32 @@ describe 'neutron::db::mysql' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:password => 'passw0rd',
|
||||
:password => 'neutronpass',
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'neutron::db::mysql' do
|
||||
context 'with only required params' do
|
||||
it { should contain_openstacklib__db__mysql('neutron').with(
|
||||
:user => 'neutron',
|
||||
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
:user => 'neutron',
|
||||
:password => 'neutronpass',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
) }
|
||||
end
|
||||
|
||||
context "overriding allowed_hosts param to array" do
|
||||
let :params do
|
||||
{
|
||||
:password => 'neutronpass',
|
||||
:allowed_hosts => ['127.0.0.1','%'],
|
||||
:password => 'neutronpass',
|
||||
:allowed_hosts => ['127.0.0.1','%'],
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_openstacklib__db__mysql('neutron').with(
|
||||
:user => 'neutron',
|
||||
:password_hash => '*E7D4FEBBE0A141B5E4B413EAF85CCB49746A2497',
|
||||
:password => 'neutronpass',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
@ -43,14 +43,14 @@ describe 'neutron::db::mysql' do
|
||||
context "overriding allowed_hosts param to string" do
|
||||
let :params do
|
||||
{
|
||||
:password => 'neutronpass2',
|
||||
:allowed_hosts => '192.168.1.1',
|
||||
:password => 'neutronpass2',
|
||||
:allowed_hosts => '192.168.1.1',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_openstacklib__db__mysql('neutron').with(
|
||||
:user => 'neutron',
|
||||
:password_hash => '*32C4202C8C2D4430442B55CCA765BD47D5D2E1A2',
|
||||
:password => 'neutronpass2',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
@ -61,14 +61,14 @@ describe 'neutron::db::mysql' do
|
||||
context "overriding allowed_hosts param equals to host param " do
|
||||
let :params do
|
||||
{
|
||||
:password => 'neutronpass2',
|
||||
:allowed_hosts => '127.0.0.1',
|
||||
:password => 'neutronpass2',
|
||||
:allowed_hosts => '127.0.0.1',
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_openstacklib__db__mysql('neutron').with(
|
||||
:user => 'neutron',
|
||||
:password_hash => '*32C4202C8C2D4430442B55CCA765BD47D5D2E1A2',
|
||||
:password => 'neutronpass2',
|
||||
:host => '127.0.0.1',
|
||||
:charset => 'utf8',
|
||||
:collate => 'utf8_general_ci',
|
||||
|
@ -3,7 +3,7 @@ require 'spec_helper'
|
||||
describe 'neutron::db::postgresql' do
|
||||
shared_examples 'neutron::db::postgresql' do
|
||||
let :req_params do
|
||||
{ :password => 'pw' }
|
||||
{ :password => 'neutronpass' }
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
@ -15,9 +15,12 @@ describe 'neutron::db::postgresql' do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { should contain_postgresql__server__db('neutron').with(
|
||||
:user => 'neutron',
|
||||
:password => 'md5696acd1dd66513a556a18a1beccd03d1'
|
||||
it { is_expected.to contain_openstacklib__db__postgresql('neutron').with(
|
||||
:user => 'neutron',
|
||||
:password => 'neutronpass',
|
||||
:dbname => 'neutron',
|
||||
:encoding => nil,
|
||||
:privileges => 'ALL',
|
||||
)}
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user