]> git.openstreetmap.org Git - chef.git/commitdiff
Make sure @directory is set properly in apache site templates
authorTom Hughes <tom@compton.nu>
Sun, 24 Nov 2013 10:56:16 +0000 (10:56 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 24 Nov 2013 10:56:16 +0000 (10:56 +0000)
cookbooks/apache/providers/site.rb

index e15646456b0c6d61571f74438fcd1ef3d71f44e5..7a18bf7f167008d5abee5ed38f7fb01dba9404a4 100644 (file)
@@ -28,7 +28,7 @@ action :create do
     owner "root"
     group "root"
     mode 0644
     owner "root"
     group "root"
     mode 0644
-    variables new_resource.variables.merge(:name => new_resource.name, :directory => new_resource.directory)
+    variables new_resource.variables.merge(:name => new_resource.name, :directory => site_directory)
     if enabled?
       notifies :reload, "service[apache2]"
     end
     if enabled?
       notifies :reload, "service[apache2]"
     end
@@ -65,6 +65,10 @@ action :delete do
   new_resource.updated_by_last_action(f.updated_by_last_action?)
 end
 
   new_resource.updated_by_last_action(f.updated_by_last_action?)
 end
 
+def site_directory
+  new_resource.directory || "/var/www/#{new_resource.name}"
+end
+
 def available_name
   "/etc/apache2/sites-available/#{new_resource.name}"
 end
 def available_name
   "/etc/apache2/sites-available/#{new_resource.name}"
 end