Skip to content

Commit

Permalink
[COOK-3851] Allow config file change notification type to be specifie…
Browse files Browse the repository at this point in the history
…d by attribute, defaulting to :restart

Signed-off-by: Sean OMeara <someara@opscode.com>
  • Loading branch information
btomasini authored and Sean OMeara committed Nov 20, 2013
1 parent cb147ab commit 6d084b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -46,6 +46,8 @@ The following attributes are set based on the platform, see the
that should be installed on "client" systems.
* `node['postgresql']['server']['packages']` - An array of package names
that should be installed on "server" systems.
* `node['postgresql']['server']['config_change_notify']` - Type of
notification triggered when a config file changes.
* `node['postgresql']['contrib']['packages']` - An array of package names
that could be installed on "server" systems for useful sysadmin tools.

Expand Down Expand Up @@ -400,6 +402,12 @@ certificates and distribute them in your own cookbook, and set the
`node['postgresql']['config']['ssl']` attribute to true in your
role/cookboook/node.

On server systems, the postgres server is restarted when a configuration
file changes. This can be changed to reload only by setting the
following attribute:

node['postgresql']['server']['config_change_notify'] = :reload

Chef Solo Note
==============

Expand Down
1 change: 1 addition & 0 deletions attributes/default.rb
Expand Up @@ -18,6 +18,7 @@
#

default['postgresql']['enable_pgdg_apt'] = false
default['postgresql']['server']['config_change_notify'] = :restart

case node['platform']
when "debian"
Expand Down
8 changes: 5 additions & 3 deletions recipes/server.rb
Expand Up @@ -57,20 +57,22 @@
include_recipe "postgresql::server_debian"
end

change_notify = node['postgresql']['server']['config_change_notify']

template "#{node['postgresql']['dir']}/postgresql.conf" do
source "postgresql.conf.erb"
owner "postgres"
group "postgres"
mode 0644
notifies :reload, 'service[postgresql]', :immediately
mode 0600
notifies change_notify, 'service[postgresql]', :immediately
end

template "#{node['postgresql']['dir']}/pg_hba.conf" do
source "pg_hba.conf.erb"
owner "postgres"
group "postgres"
mode 00600
notifies :reload, 'service[postgresql]', :immediately
notifies change_notify, 'service[postgresql]', :immediately
end

# NOTE: Consider two facts before modifying "assign-postgres-password":
Expand Down

0 comments on commit 6d084b2

Please sign in to comment.