hw-cookbooks/postgresql — pull request #174 by SimonKaluza (2014-09-05 14:35:57+00:00)
Title: Added initialization of an alternate Postgres data_directory for Ubuntu

This is a patch for https://github.com/hw-cookbooks/postgresql/issues/143. It's not perfect, but it gets the job done for my Debian-specific usecase and could probably be adapted for RedHat fairly easily.

I added a few blocks to conditionally copy default Debian Postgres data_directory files generated from the package manager's installation of postgres to the custom data_directory specified by the existing `node['postgresql']['config']['data_directory]` attribute if it's empty.

This could probably done by calling `initdb` in this directory as well, but I wanted to set it up so that a server already using the default databases would also have its files moved in an idempotent way. I submitted this PR just incase the core team/maintainers want a band aid until a more generalized solution is developed they can use this.