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

Commit

Permalink
Merge pull request #34 from boxen/fix-db-creation-for-nonstandard-hom…
Browse files Browse the repository at this point in the history
…ebrew-location

Fix exec resources for nonstandard homebrew location
  • Loading branch information
dgoodlad committed Dec 18, 2014
2 parents 898e79a + 34159c2 commit e7d7c4e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions manifests/db.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

exec { "postgresql-db-${name}":
command => join([
'createdb',
"${postgresql::bindir}/createdb",
"-p${postgresql::port}",
'-E UTF-8',
"-O ${postgresql::user}",
$name
], ' '),
unless => "psql -aA -p${postgresql::port} -t -l | cut -d \\| -f 1 | grep -w '${name}'"
unless => "${postgresql::bindir}/psql -aA -p${postgresql::port} -t -l | cut -d \\| -f 1 | grep -w '${name}'"
}
}
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class postgresql(
$ensure = $postgresql::params::ensure,

$bindir = $postgresql::params::bindir,
$executable = $postgresql::params::executable,

$host = $postgresql::params::host,
Expand Down
4 changes: 3 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
Darwin: {
include boxen::config

$executable = "${boxen::config::homebrewdir}/bin/postgres"
$bindir = "${boxen::config::homebrewdir}/bin"
$executable = "${binpath}/postgres"
$datadir = "${boxen::config::datadir}/postgresql"
$logdir = "${boxen::config::logdir}/postgresql"
$port = 15432
Expand All @@ -20,6 +21,7 @@

Ubuntu: {
$executable = undef # only used on Darwin
$bindir = '/usr/bin'
$datadir = '/var/lib/postgresql'
$logdir = '/var/log/postgresql'
$port = 5432
Expand Down
3 changes: 2 additions & 1 deletion manifests/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
$service = $postgresql::params::service,
$enable = $postgresql::params::enable,

$bindir = $postgresql::params::bindir,
$datadir = $postgresql::params::datadir,
$host = $postgresql::params::host,
$port = $postgresql::params::port,
Expand All @@ -27,7 +28,7 @@
}

exec { 'init-postgresql-db':
command => "initdb -E UTF-8 ${datadir}",
command => "${bindir}/initdb -E UTF-8 ${datadir}",
creates => "${datadir}/PG_VERSION",
}

Expand Down
4 changes: 2 additions & 2 deletions spec/defines/postgresql_db_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
should include_class("postgresql")

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

0 comments on commit e7d7c4e

Please sign in to comment.