Use default_database in validate_db_connection
This commit modifies postgresql::validate_db_connection to use the default_database parameter from postgresql::params rather than hard-coding a local default value of "postgres".
This commit is contained in:
parent
cdf5b077fe
commit
b4a855c331
1 changed files with 6 additions and 5 deletions
|
@ -5,7 +5,7 @@
|
|||
# See README.md for more details.
|
||||
define postgresql::validate_db_connection(
|
||||
$database_host = undef,
|
||||
$database_name = 'postgres',
|
||||
$database_name = undef,
|
||||
$database_password = undef,
|
||||
$database_username = undef,
|
||||
$database_port = undef,
|
||||
|
@ -15,25 +15,26 @@ define postgresql::validate_db_connection(
|
|||
$create_db_first = true
|
||||
) {
|
||||
require postgresql::client
|
||||
include postgresql::params
|
||||
|
||||
$psql_path = $postgresql::params::psql_path
|
||||
|
||||
$cmd_init = "${psql_path} --tuples-only --quiet "
|
||||
$cmd_host = $database_host ? {
|
||||
default => "-h ${database_host} ",
|
||||
undef => ""
|
||||
undef => "",
|
||||
}
|
||||
$cmd_user = $database_username ? {
|
||||
default => "-U ${database_username} ",
|
||||
undef => ""
|
||||
undef => "",
|
||||
}
|
||||
$cmd_port = $database_port ? {
|
||||
default => "-p ${database_port} ",
|
||||
undef => ""
|
||||
undef => "",
|
||||
}
|
||||
$cmd_dbname = $database_name ? {
|
||||
default => "--dbname ${database_name} ",
|
||||
undef => ""
|
||||
undef => "--dbname ${postgresql::params::default_database} ",
|
||||
}
|
||||
$env = $database_password ? {
|
||||
default => "PGPASSWORD=${database_password}",
|
||||
|
|
Loading…
Reference in a new issue