Skip to content

Commit 828c3b9

Browse files
committed
use fully-qualified path to psql to set password
When setting the a user's password, use the fully qualified path to the psql binary. This should fix puppetlabs#359
1 parent fd29d1c commit 828c3b9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

manifests/server/passwd.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
$postgres_password = $postgresql::server::postgres_password
55
$user = $postgresql::server::user
66
$group = $postgresql::server::group
7+
$psql_path = $postgresql::server::psql_path
78

89
if($ensure == 'present' or $ensure == true) {
910
if ($postgres_password != undef) {
@@ -16,7 +17,7 @@
1617
exec { 'set_postgres_postgrespw':
1718
# This command works w/no password because we run it as postgres system
1819
# user
19-
command => "psql -c 'ALTER ROLE \"${user}\" PASSWORD ${escaped}'",
20+
command => "${psql_path} -c 'ALTER ROLE \"${user}\" PASSWORD ${escaped}'",
2021
user => $user,
2122
group => $group,
2223
logoutput => true,
@@ -26,7 +27,7 @@
2627
# environment variable. If the password is correct (current), this
2728
# command will exit with an exit code of 0, which will prevent the main
2829
# command from running.
29-
unless => "${env} psql -h localhost -c 'select 1' > /dev/null",
30+
unless => "${env} ${psql_path} -h localhost -c 'select 1' > /dev/null",
3031
path => '/usr/bin:/usr/local/bin:/bin',
3132
}
3233
}

0 commit comments

Comments
 (0)