-attribute :name, :kind_of => String, :name_attribute => true
-attribute :cookbook, :kind_of => [String, nil]
-attribute :template, :kind_of => String, :required => true
-attribute :variables, :kind_of => Hash, :default => {}
-attribute :restart_munin, :kind_of => [TrueClass, FalseClass], :default => true
+property :plugin_conf, :kind_of => String, :name_property => true
+property :cookbook, :kind_of => [String, nil]
+property :template, :kind_of => String, :required => [:create]
+property :variables, :kind_of => Hash, :default => {}
+property :restart_munin, :kind_of => [TrueClass, FalseClass], :default => true
+
+action :create do
+ declare_resource :template, config_file do
+ cookbook new_resource.cookbook
+ source new_resource.template
+ owner "root"
+ group "root"
+ mode "644"
+ variables new_resource.variables.merge(:name => new_resource.plugin_conf)
+ end
+end
+
+action :delete do
+ file config_file do
+ action :delete
+ end
+end
+
+action_class do
+ def config_file
+ "/etc/munin/plugin-conf.d/#{new_resource.plugin_conf}"
+ end
+end