]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/tile/recipes/default.rb
Manage the permissions of the nodes file
[chef.git] / cookbooks / tile / recipes / default.rb
index 824b6cf58f4346d68a50c810da18317f540ce17a..d2f875611e6a9630890b820d3e3f3822ab14f384 100644 (file)
@@ -368,11 +368,19 @@ postgresql_munin "gis" do
   database "gis"
 end
 
-#file node[:tile][:node_file] do
-#  owner "tile"
-#  group "www-data"
-#  mode 0640
-#end
+tile_uid = node[:etc][:passwd]["tile"][:uid]
+www_data_gid = node[:etc][:group]["www-data"][:gid]
+
+ruby_block node[:tile][:node_file] do
+  block do
+    File.chown(tile_uid, www_data_gid, node[:tile][:node_file])
+    File.chmod(0640, node[:tile][:node_file])
+  end
+  not_if do
+    stat = File.stat(node[:tile][:node_file])
+    stat.uid == tile_uid && stat.gid == www_data_gid && stat.mode == 0640
+  end
+end
 
 directory "/var/log/tile" do
   owner "tile"