X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/069e33163e0b09a7d647a98c2fde284a16a43b99..2f6d3889b436d19d53c6d8b4db4691a11449f266:/cookbooks/apache/providers/module.rb?ds=sidebyside diff --git a/cookbooks/apache/providers/module.rb b/cookbooks/apache/providers/module.rb index 0a85f7ee4..252b5e816 100644 --- a/cookbooks/apache/providers/module.rb +++ b/cookbooks/apache/providers/module.rb @@ -21,75 +21,59 @@ def whyrun_supported? true end +use_inline_resources + action :install do - if !installed? + unless installed? package package_name - - updated = true - else - updated = false end - if new_resource.conf - t = template available_name("conf") do + if new_resource.conf # ~FC023 + template available_name("conf") do source new_resource.conf owner "root" group "root" - mode 0644 + mode 0o644 variables new_resource.variables - notifies :reload, "service[apache2]" if enabled? end - - updated ||= t.updated_by_last_action? end - - new_resource.updated_by_last_action(updated) end action :enable do - unless enabled? - link enabled_name("load") do - to available_name("load") - owner "root" - group "root" - notifies :restart, "service[apache2]" - end + execute "a2enmod-#{new_resource.name}" do + command "a2enmod #{new_resource.name}" + user "root" + group "root" + not_if { ::File.exist?(enabled_name("load")) } + end - link enabled_name("conf") do - to available_name("conf") - owner "root" - group "root" - notifies :reload, "service[apache2]" - only_if { ::File.exist?(available_name("conf")) } - end + link enabled_name("load") do + to available_name("load") + owner "root" + group "root" + end - new_resource.updated_by_last_action(true) + link enabled_name("conf") do + to available_name("conf") + owner "root" + group "root" + only_if { ::File.exist?(available_name("conf")) } end end action :disable do - if enabled? - link enabled_name("load") do - action :delete - notifies :restart, "service[apache2]" - end - - link enabled_name("conf") do - action :delete - notifies :reload, "service[apache2]" - end + link enabled_name("load") do + action :delete + end - new_resource.updated_by_last_action(true) + link enabled_name("conf") do + action :delete end end action :delete do - if installed? - package package_name do - action :remove - end - - new_resource.updated_by_last_action(true) + package package_name do + action :remove end end @@ -108,7 +92,3 @@ end def installed? ::File.exist?(available_name("load")) end - -def enabled? - ::File.exist?(enabled_name("load")) -end