X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/08c435b987e0d5035af9cfa6480e8c04b7466303..b25b96fb7ba845165a157faa87ed39a425a10d80:/cookbooks/hardware/recipes/default.rb diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index c29185248..d929bbf57 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -298,6 +298,8 @@ end end disks = node[:hardware][:disk][: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/", "") @@ -311,11 +313,13 @@ disks = node[:hardware][:disk][:disks].map do |disk| elsif smart =~ %r{^.*,(\d+)/(\d+)$} munin = "#{device}-#{Regexp.last_match(1)}:#{Regexp.last_match(2)}" end - else + elsif disk[:device] device = disk[:device].sub("/dev/", "") munin = device end + next if device.nil? + Hash[ :device => device, :smart => smart, @@ -324,6 +328,8 @@ disks = node[:hardware][:disk][:disks].map do |disk| ] end +disks = disks.compact + if disks.count > 0 package "smartmontools"