]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/postgresql/recipes/default.rb
Wait until postgres is configured before starting it
[chef.git] / cookbooks / postgresql / recipes / default.rb
index a8b37c59062b8fa7d8b4e81375e1845dd3d44bcc..a0d9f0e90a3de04b165753cb8bf2e6958c92c70b 100644 (file)
 
 package "postgresql-common"
 
-service "postgresql" do
-  action [ :enable, :start ]
-  supports :status => true, :restart => true, :reload => true
-end
-
 node[:postgresql][:versions].each do |version|
   package "postgresql-#{version}"
   package "postgresql-client-#{version}"
@@ -89,6 +84,11 @@ node[:postgresql][:versions].each do |version|
   end
 end
 
+service "postgresql" do
+  action [:enable, :start]
+  supports :status => true, :restart => true, :reload => true
+end
+
 ohai_plugin "postgresql" do
   template "ohai.rb.erb"
 end
@@ -131,11 +131,11 @@ clusters.each do |name, details|
     conf_variables :port => details[:port]
   end
 
-  if File.exist?("/var/lib/postgresql/#{details[:version]}/main/recovery.conf")
-    munin_plugin "postgres_replication_#{suffix}" do
-      target "postgres_replication"
-      conf "munin.erb"
-      conf_variables :port => details[:port]
-    end
+  next unless File.exist?("/var/lib/postgresql/#{details[:version]}/main/recovery.conf")
+
+  munin_plugin "postgres_replication_#{suffix}" do
+    target "postgres_replication"
+    conf "munin.erb"
+    conf_variables :port => details[:port]
   end
 end