X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/f0953bbd48a2310f6046b88e35c4f5950f13dda7..52e464a8e1bd7572fb865d12f1617666db15b072:/cookbooks/hardware/recipes/default.rb diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index 0b7b3e6f3..8ba21da8b 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -297,7 +297,15 @@ end end end -disks = node[:hardware][:disk][:disks].map do |disk| +if node[:hardware][:disk] + disks = node[:hardware][:disk][:disks] +else + disks = [] +end + +disks = disks.map do |disk| + next if disk[:state] == "spun_down" + if disk[:smart_device] controller = node[:hardware][:disk][:controllers][disk[:controller]] device = controller[:device].sub("/dev/", "") @@ -435,7 +443,11 @@ if node[:lsb][:release].to_f <= 12.10 end else service "kmod" do - provider Chef::Provider::Service::Upstart + if node[:lsb][:release].to_f >= 15.10 + provider Chef::Provider::Service::Systemd + else + provider Chef::Provider::Service::Upstart + end action :nothing subscribes :start, "template[/etc/modules]" end