2 # Cookbook Name:: munin
3 # Provider:: munin_plugin
5 # Copyright 2013, OpenStreetMap Foundation
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
25 link_action = case target_path
30 l = link plugin_path do
33 notifies :restart, "service[munin-node]"
36 updated = l.updated_by_last_action?
39 c = munin_plugin_conf new_resource.name do
40 cookbook new_resource.conf_cookbook
41 template new_resource.conf
42 variables new_resource.conf_variables
45 updated = updated || c.updated_by_last_action?
48 new_resource.updated_by_last_action(updated)
52 l = link plugin_path do
54 notifies :restart, "service[munin-node]"
57 updated = l.updated_by_last_action?
60 c = munin_plugin_conf new_resource.name do
64 updated = updated || c.updated_by_last_action?
67 new_resource.updated_by_last_action(updated)
71 "/etc/munin/plugins/#{new_resource.name}"
76 when ::File.exists?(target)
78 when ::File.exists?("/usr/local/share/munin/plugins/#{target}")
79 "/usr/local/share/munin/plugins/#{target}"
80 when ::File.exists?("/usr/share/munin/plugins/#{target}")
81 "/usr/share/munin/plugins/#{target}"
88 new_resource.target || new_resource.name