]> git.openstreetmap.org Git - chef.git/blob - cookbooks/ohai/providers/plugin.rb
move reverse queries back to pummelzacken
[chef.git] / cookbooks / ohai / providers / plugin.rb
1 #
2 # Cookbook Name:: ohai
3 # Provider:: ohai_plugin
4 #
5 # Copyright 2015, OpenStreetMap Foundation
6 #
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
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19
20 def whyrun_supported?
21   true
22 end
23
24 use_inline_resources
25
26 action :create do
27   ohai new_resource.name do
28     action :nothing
29   end
30
31   template plugin_path do
32     source new_resource.template
33     owner "root"
34     group "root"
35     mode 0644
36     notifies :reload, "ohai[#{new_resource.name}]"
37   end
38 end
39
40 action :delete do
41   template plugin_path do
42     action :delete
43   end
44 end
45
46 def plugin_path
47   "/etc/chef/ohai/#{new_resource.name}.rb"
48 end