X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/4787523adf3d90b98c0d23d405f7609fb07829fc..9d27360314f8e4e9844cde4059f98fac52250d36:/cookbooks/munin/providers/plugin.rb diff --git a/cookbooks/munin/providers/plugin.rb b/cookbooks/munin/providers/plugin.rb index 4361514fb..e469acb6d 100644 --- a/cookbooks/munin/providers/plugin.rb +++ b/cookbooks/munin/providers/plugin.rb @@ -21,50 +21,38 @@ def whyrun_supported? true end +use_inline_resources + action :create do link_action = case target_path when nil then :delete else :create end - l = link plugin_path do + link plugin_path do action link_action to target_path - notifies :restart, "service[munin-node]" end - updated = l.updated_by_last_action? - - if new_resource.conf - c = munin_plugin_conf new_resource.name do + if new_resource.conf # ~FC023 + munin_plugin_conf new_resource.name do cookbook new_resource.conf_cookbook template new_resource.conf variables new_resource.conf_variables end - - updated = updated || c.updated_by_last_action? end - - new_resource.updated_by_last_action(updated) end action :delete do - l = link plugin_path do + link plugin_path do action :delete - notifies :restart, "service[munin-node]" end - updated = l.updated_by_last_action? - - if new_resource.conf - c = munin_plugin_conf new_resource.name do + if new_resource.conf # ~FC023 + munin_plugin_conf new_resource.name do action :delete end - - updated = updated || c.updated_by_last_action? end - - new_resource.updated_by_last_action(updated) end def plugin_path @@ -73,14 +61,12 @@ end def target_path case - when ::File.exists?(target) + when ::File.exist?(target) target - when ::File.exists?("/usr/local/share/munin/plugins/#{target}") + when ::File.exist?("/usr/local/share/munin/plugins/#{target}") "/usr/local/share/munin/plugins/#{target}" - when ::File.exists?("/usr/share/munin/plugins/#{target}") + when ::File.exist?("/usr/share/munin/plugins/#{target}") "/usr/share/munin/plugins/#{target}" - else - nil end end