From 6d084b2c02332c0505e28df3458baf4c7ff14217 Mon Sep 17 00:00:00 2001 From: Ben Tomasini Date: Wed, 20 Nov 2013 18:19:38 -0500 Subject: [PATCH] [COOK-3851] Allow config file change notification type to be specified by attribute, defaulting to :restart Signed-off-by: Sean OMeara --- README.md | 8 ++++++++ attributes/default.rb | 1 + recipes/server.rb | 8 +++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5f689882b..534242951 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 ============== diff --git a/attributes/default.rb b/attributes/default.rb index 928da1bbb..e6e17b720 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -18,6 +18,7 @@ # default['postgresql']['enable_pgdg_apt'] = false +default['postgresql']['server']['config_change_notify'] = :restart case node['platform'] when "debian" diff --git a/recipes/server.rb b/recipes/server.rb index b596dec46..9912dd5d7 100644 --- a/recipes/server.rb +++ b/recipes/server.rb @@ -57,12 +57,14 @@ 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 @@ -70,7 +72,7 @@ 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":