Skip to content
This repository was archived by the owner on Dec 2, 2020. It is now read-only.

Commit e7d7c4e

Browse files
committed
Merge pull request #34 from boxen/fix-db-creation-for-nonstandard-homebrew-location
Fix exec resources for nonstandard homebrew location
2 parents 898e79a + 34159c2 commit e7d7c4e

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

manifests/db.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010

1111
exec { "postgresql-db-${name}":
1212
command => join([
13-
'createdb',
13+
"${postgresql::bindir}/createdb",
1414
"-p${postgresql::port}",
1515
'-E UTF-8',
1616
"-O ${postgresql::user}",
1717
$name
1818
], ' '),
19-
unless => "psql -aA -p${postgresql::port} -t -l | cut -d \\| -f 1 | grep -w '${name}'"
19+
unless => "${postgresql::bindir}/psql -aA -p${postgresql::port} -t -l | cut -d \\| -f 1 | grep -w '${name}'"
2020
}
2121
}

manifests/init.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
class postgresql(
77
$ensure = $postgresql::params::ensure,
88

9+
$bindir = $postgresql::params::bindir,
910
$executable = $postgresql::params::executable,
1011

1112
$host = $postgresql::params::host,

manifests/params.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
Darwin: {
66
include boxen::config
77

8-
$executable = "${boxen::config::homebrewdir}/bin/postgres"
8+
$bindir = "${boxen::config::homebrewdir}/bin"
9+
$executable = "${binpath}/postgres"
910
$datadir = "${boxen::config::datadir}/postgresql"
1011
$logdir = "${boxen::config::logdir}/postgresql"
1112
$port = 15432
@@ -20,6 +21,7 @@
2021

2122
Ubuntu: {
2223
$executable = undef # only used on Darwin
24+
$bindir = '/usr/bin'
2325
$datadir = '/var/lib/postgresql'
2426
$logdir = '/var/log/postgresql'
2527
$port = 5432

manifests/service.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
$service = $postgresql::params::service,
66
$enable = $postgresql::params::enable,
77

8+
$bindir = $postgresql::params::bindir,
89
$datadir = $postgresql::params::datadir,
910
$host = $postgresql::params::host,
1011
$port = $postgresql::params::port,
@@ -27,7 +28,7 @@
2728
}
2829

2930
exec { 'init-postgresql-db':
30-
command => "initdb -E UTF-8 ${datadir}",
31+
command => "${bindir}/initdb -E UTF-8 ${datadir}",
3132
creates => "${datadir}/PG_VERSION",
3233
}
3334

spec/defines/postgresql_db_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
should include_class("postgresql")
99

1010
should contain_exec("postgresql-db-#{title}").with({
11-
:command => "createdb -p15432 -E UTF-8 -O testuser #{title}",
12-
:unless => "psql -aA -p15432 -t -l | cut -d \\| -f 1 | grep -w '#{title}'"
11+
:command => "/test/boxen/homebrew/bin/createdb -p15432 -E UTF-8 -O testuser #{title}",
12+
:unless => "/test/boxen/homebrew/bin/psql -aA -p15432 -t -l | cut -d \\| -f 1 | grep -w '#{title}'"
1313
})
1414
end
1515
end

0 commit comments

Comments
 (0)