]> git.openstreetmap.org Git - chef.git/commitdiff
Delay generation of taginfo settings until the template exists
authorTom Hughes <tom@compton.nu>
Mon, 24 Nov 2014 14:48:55 +0000 (14:48 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 24 Nov 2014 14:54:13 +0000 (14:54 +0000)
cookbooks/taginfo/recipes/default.rb

index 6c0062f9978da0747534a4575cbc0b44409ccb8f..45b09b54eef48775d3ddace7031396f4134da8bd 100644 (file)
@@ -105,29 +105,33 @@ node[:taginfo][:sites].each do |site|
     group "taginfo"
   end
 
-  settings = JSON.parse(IO.read("#{directory}/taginfo/taginfo-config-example.json"))
-
-  settings["instance"]["url"] = "http://#{name}/"
-  settings["instance"]["description"] = description
-  settings["instance"]["about"] = about
-  settings["instance"]["icon"] = "/img/logo/#{icon}.png"
-  settings["instance"]["contact"] = contact
-  settings["instance"]["access_control_allow_origin"] = ""
-  settings["logging"]["directory"] = "/var/log/taginfo/#{name}"
-  settings["opensearch"]["shortname"] = "Taginfo"
-  settings["opensearch"]["contact"] = "webmaster@openstreetmap.org"
-  settings["sources"]["download"] = "josm"
-  settings["sources"]["create"] = "db languages potlatch projects wiki"
-  settings["sources"]["db"]["planetfile"] = "#{directory}/planet/planet.pbf"
-  settings["sources"]["db"]["tagstats"] = "#{directory}/taginfo/tagstats/tagstats"
-  settings["tagstats"]["cxxflags"] = "-I../../osmium/include"
-  settings["tagstats"]["geodistribution"] = "MmapAnon"
+  settings = Chef::DelayedEvaluator.new do
+    settings = JSON.parse(IO.read("#{directory}/taginfo/taginfo-config-example.json"))
+
+    settings["instance"]["url"] = "http://#{name}/"
+    settings["instance"]["description"] = description
+    settings["instance"]["about"] = about
+    settings["instance"]["icon"] = "/img/logo/#{icon}.png"
+    settings["instance"]["contact"] = contact
+    settings["instance"]["access_control_allow_origin"] = ""
+    settings["logging"]["directory"] = "/var/log/taginfo/#{name}"
+    settings["opensearch"]["shortname"] = "Taginfo"
+    settings["opensearch"]["contact"] = "webmaster@openstreetmap.org"
+    settings["sources"]["download"] = "josm"
+    settings["sources"]["create"] = "db languages potlatch projects wiki"
+    settings["sources"]["db"]["planetfile"] = "#{directory}/planet/planet.pbf"
+    settings["sources"]["db"]["tagstats"] = "#{directory}/taginfo/tagstats/tagstats"
+    settings["tagstats"]["cxxflags"] = "-I../../osmium/include"
+    settings["tagstats"]["geodistribution"] = "MmapAnon"
+
+    JSON.pretty_generate(settings)
+  end
 
   file "#{directory}/taginfo-config.json" do
     owner "taginfo"
     group "taginfo"
     mode 0644
-    content JSON.pretty_generate(settings)
+    content settings
   end
 
   execute "#{directory}/taginfo/tagstats/Makefile" do