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