]> git.openstreetmap.org Git - chef.git/blob - cookbooks/hardware/attributes/default.rb
Fix some foodcritic complaints
[chef.git] / cookbooks / hardware / attributes / default.rb
1 default[:hardware][:modules] = %w(loop lp rtc)
2 default[:hardware][:sensors] = {}
3
4 if node[:dmi] && node[:dmi][:system]
5   case dmi.system.manufacturer
6   when "HP"
7     default[:apt][:sources] |= ["management-component-pack"]
8
9     case dmi.system.product_name
10     when "ProLiant DL360 G6", "ProLiant DL360 G7"
11       default[:hardware][:sensors][:"power_meter-*"][:power][:"power1"] = { :ignore => true }
12     end
13   end
14 end
15
16 if Chef::Util.compare_versions(node[:kernel][:release], [3, 3]) < 0
17   default[:hardware][:modules] |= ["microcode"]
18
19   if node[:cpu][:"0"][:vendor_id] == "GenuineIntel"
20     default[:hardware][:modules] |= ["coretemp"]
21   end
22 end
23
24 if node[:kernel] && node[:kernel][:modules]
25   raidmods = node[:kernel][:modules].keys & %w(cciss hpsa mptsas mpt2sas megaraid_mm megaraid_sas aacraid)
26
27   unless raidmods.empty?
28     default[:apt][:sources] |= ["hwraid"]
29   end
30 end
31
32 if node[:kernel][:modules].include?("ipmi_si")
33   default[:hardware][:modules] |= ["ipmi_devintf"]
34 end
35
36 if File.exist?("/proc/xen")
37   default[:hardware][:watchdog] = "xen_wdt"
38 elsif node[:kernel][:modules].include?("i6300esb")
39   default[:hardware][:watchdog] = "none"
40 end