X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/7ae16f9ab1f5c111c81335bdfb143f267f4e2d28..fe3e73cc0b30c8cd48584d0e97d4da7c06110308:/cookbooks/apache/providers/site.rb diff --git a/cookbooks/apache/providers/site.rb b/cookbooks/apache/providers/site.rb index 145d35598..7a18bf7f1 100644 --- a/cookbooks/apache/providers/site.rb +++ b/cookbooks/apache/providers/site.rb @@ -28,7 +28,7 @@ action :create do 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 @@ -38,8 +38,8 @@ action :create do end action :enable do - l = link enabled_file do - to available_file + l = link enabled_name do + to available_name owner "root" group "root" notifies :reload, "service[apache2]" @@ -49,7 +49,7 @@ action :enable do end action :disable do - l = link enabled_file do + l = link enabled_name do action :delete notifies :reload, "service[apache2]" end @@ -65,6 +65,10 @@ action :delete do 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 @@ -79,5 +83,5 @@ def enabled_name end def enabled? - File.exists?(enabled_name) + ::File.exists?(enabled_name) end