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 ||= 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 ||= c.updated_by_last_action?
end
-
- new_resource.updated_by_last_action(updated)
end
def plugin_path
true
end
+use_inline_resources
+
action :create do
- t = template config_file do
+ template config_file do
cookbook new_resource.cookbook
source new_resource.template
owner "root"
group "root"
mode 0644
variables new_resource.variables.merge(:name => new_resource.name)
- notifies :restart, "service[munin-node]"
end
-
- new_resource.updated_by_last_action(t.updated_by_last_action?)
end
action :delete do
- f = file config_file do
+ file config_file do
action :delete
end
-
- new_resource.updated_by_last_action(f.updated_by_last_action?)
end
def config_file
attribute :conf, :kind_of => String
attribute :conf_cookbook, :kind_of => String
attribute :conf_variables, :kind_of => Hash, :default => {}
+
+def initialize(*args)
+ super
+ notifies :restart, "service[munin-node]"
+end
attribute :cookbook, :kind_of => String
attribute :template, :kind_of => String, :required => true
attribute :variables, :kind_of => Hash, :default => {}
+
+def initialize(*args)
+ super
+ begin
+ resources(:service => "munin-node").subscrbes(:restart, self)
+ rescue Chef::Exceptions::ResourceNotFound
+ # Ignore
+ end
+end