]> git.openstreetmap.org Git - chef.git/blob - cookbooks/postgresql/templates/default/ohai.rb.erb
Allow cpu_tuple_cost to be configured for postgres
[chef.git] / cookbooks / postgresql / templates / default / ohai.rb.erb
1 provides "postgresql"
2
3 postgresql Mash.new
4
5 Dir.glob("/etc/postgresql/*/*/postgresql.conf").each do |conf|
6   cluster = conf.sub("/etc/postgresql/", "").sub("/postgresql.conf", "")
7
8   postgresql[:clusters] = Mash.new unless postgresql[:clusters]
9   postgresql[:clusters][cluster] = Mash.new unless postgresql[:clusters][cluster]
10   postgresql[:clusters][cluster][:version] = cluster.split("/").first.to_f
11
12   IO.foreach(conf) do |line|
13     if line =~ /^ *port *= *([0-9]+)\s+/
14       postgresql[:clusters][cluster][:port] = $1
15     end
16   end
17 end