X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/faf8ae12e85eabb050b0f5eceb2cb67ad1de5261..5f3a5421476c68027c50b821916585ab01f0efa1:/cookbooks/postgresql/templates/default/ohai.rb.erb?ds=sidebyside diff --git a/cookbooks/postgresql/templates/default/ohai.rb.erb b/cookbooks/postgresql/templates/default/ohai.rb.erb index e3eca3a35..cec796f6f 100644 --- a/cookbooks/postgresql/templates/default/ohai.rb.erb +++ b/cookbooks/postgresql/templates/default/ohai.rb.erb @@ -1,17 +1,21 @@ -provides "postgresql" +Ohai.plugin(:Postgresql) do + provides "postgresql" -postgresql Mash.new + collect_data(:default) do + postgresql Mash.new -Dir.glob("/etc/postgresql/*/*/postgresql.conf").each do |conf| - cluster = conf.sub("/etc/postgresql/", "").sub("/postgresql.conf", "") + Dir.glob("/etc/postgresql/*/*/postgresql.conf").each do |conf| + cluster = conf.sub("/etc/postgresql/", "").sub("/postgresql.conf", "") - postgresql[:clusters] = Mash.new unless postgresql[:clusters] - postgresql[:clusters][cluster] = Mash.new unless postgresql[:clusters][cluster] - postgresql[:clusters][cluster][:version] = cluster.split("/").first.to_f + postgresql[:clusters] = Mash.new unless postgresql[:clusters] + postgresql[:clusters][cluster] = Mash.new unless postgresql[:clusters][cluster] + postgresql[:clusters][cluster][:version] = cluster.split("/").first.to_f - IO.foreach(conf) do |line| - if line =~ /^ *port *= *([0-9]+)\s+/ - postgresql[:clusters][cluster][:port] = $1 + IO.foreach(conf) do |line| + if line =~ /^ *port *= *([0-9]+)\s+/ + postgresql[:clusters][cluster][:port] = $1 + end + end end end end