Skip to content

Commit b50b05c

Browse files
committed
Add the new params to init.pp as well
1 parent 7b12810 commit b50b05c

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ The password for the database user. Defaults to `puppetdb`, ignored for
405405

406406
#### `manage_db_password`
407407

408-
Whether or not the database_password in database.ini will be managed by this module.
408+
Whether or not the database password in database.ini will be managed by this module.
409409
Set this to `false` if you want to set the password some other way.
410410
Defaults to `true`
411411

@@ -569,7 +569,7 @@ supported in PuppetDB >= 1.6.
569569

570570
#### `manage_read_db_password`
571571

572-
Whether or not the database\_password in read-database.ini will be managed by this module.
572+
Whether or not the database password in read-database.ini will be managed by this module.
573573
Set this to `false` if you want to set the password some other way.
574574
Defaults to `true`
575575

manifests/init.pp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
$database_username = $puppetdb::params::database_username,
3131
$database_password = $puppetdb::params::database_password,
3232
$database_name = $puppetdb::params::database_name,
33+
$manage_db_password = $puppetdb::params::manage_db_password,
3334
$jdbc_ssl_properties = $puppetdb::params::jdbc_ssl_properties,
3435
$database_listen_address = $puppetdb::params::postgres_listen_addresses,
3536
$database_validate = $puppetdb::params::database_validate,
@@ -53,6 +54,7 @@
5354
$read_database_username = $puppetdb::params::read_database_username,
5455
$read_database_password = $puppetdb::params::read_database_password,
5556
$read_database_name = $puppetdb::params::read_database_name,
57+
$manage_read_db_password = $puppetdb::params::manage_read_db_password,
5658
$read_database_jdbc_ssl_properties = $puppetdb::params::read_database_jdbc_ssl_properties,
5759
$read_database_validate = $puppetdb::params::read_database_validate,
5860
$read_log_slow_statements = $puppetdb::params::read_log_slow_statements,
@@ -105,6 +107,7 @@
105107
database_username => $database_username,
106108
database_password => $database_password,
107109
database_name => $database_name,
110+
manage_db_password => $manage_db_password,
108111
jdbc_ssl_properties => $jdbc_ssl_properties,
109112
database_validate => $database_validate,
110113
database_embedded_path => $database_embedded_path,
@@ -130,6 +133,7 @@
130133
read_database_username => $read_database_username,
131134
read_database_password => $read_database_password,
132135
read_database_name => $read_database_name,
136+
manage_read_db_password => $manage_read_db_password,
133137
read_database_jdbc_ssl_properties => $read_database_jdbc_ssl_properties,
134138
read_database_validate => $read_database_validate,
135139
read_log_slow_statements => $read_log_slow_statements,

spec/unit/classes/init_spec.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,24 @@ class { 'postgresql::server':
4848
it { is_expected.not_to contain_postgresql__server__db('puppetdb') }
4949
end
5050
end
51+
52+
context 'when not managing the database password' do
53+
let(:params) do
54+
{
55+
'manage_db_password' => false,
56+
'manage_read_db_password' => false,
57+
'read_database_host' => '10.0.0.1', # Make sure the read_database class is enforced.
58+
}
59+
end
60+
61+
describe 'ini_setting entries for the password will not exist' do
62+
it { is_expected.to contain_class('puppetdb::server').with('manage_db_password' => false) }
63+
it { is_expected.to contain_class('puppetdb::server').with('manage_read_db_password' => false) }
64+
65+
it { is_expected.not_to contain_ini__setting('puppetdb_psdatabase_password') }
66+
it { is_expected.not_to contain_ini__setting('puppetdb_read_database_password') }
67+
end
68+
end
5169
end
5270
end
5371

0 commit comments

Comments
 (0)