Skip to content

Commit 357fa06

Browse files
fix: use provided database port in pgpass
refactor: more readable code
1 parent 0c4bd78 commit 357fa06

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

manifests/database/postgresql.pp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@
6868
}
6969
}
7070

71+
$db_port = pick($database_port, '5432')
72+
7173
exec { 'update_pgpass':
72-
command => "echo ${database_host}:5432:${database_name}:${database_user}:${database_password} >> /root/.pgpass",
74+
command => "echo ${database_host}:${db_port}:${database_name}:${database_user}:${database_password} >> /root/.pgpass",
7375
path => "/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:${database_path}",
74-
unless => "grep \"${database_host}:5432:${database_name}:${database_user}:${database_password}\" /root/.pgpass",
76+
unless => "grep \"${database_host}:${db_port}:${database_name}:${database_user}:${database_password}\" /root/.pgpass",
7577
require => File['/root/.pgpass'],
7678
}
7779

0 commit comments

Comments
 (0)