Make database_password an optional parameter

In some cases it may not be possible to securely specify a password for
PuppetDB. When that is true, it's impossible to use the module to manage
PuppetDB, because specifying undef for the password will cause database
validation to fail, or for the setting in database.ini to be overridden.

This change will simply check that database_password is set, and will
skip validation and changing database.ini in the case where it is not.
This commit is contained in:
Nick Lewis 2013-08-12 13:20:18 -07:00
parent 45f9de11d6
commit 2f12a5d7c0
2 changed files with 6 additions and 4 deletions

View file

@ -87,9 +87,11 @@ class puppetdb::server::database_ini(
value => $database_username,
}
ini_setting {'puppetdb_psdatabase_password':
setting => 'password',
value => $database_password,
if $database_password != undef {
ini_setting {'puppetdb_psdatabase_password':
setting => 'password',
value => $database_password,
}
}
}

View file

@ -52,7 +52,7 @@ class puppetdb::server::validate_db(
) inherits puppetdb::params {
# We don't need any validation for the embedded database, presumably.
if ($database == 'postgres') {
if ($database == 'postgres' and $database_password != undef) {
postgresql::validate_db_connection { 'validate puppetdb postgres connection':
database_host => $database_host,
database_port => $database_port,