From: Tom Hughes Date: Tue, 22 Dec 2015 22:34:25 +0000 (+0000) Subject: Ignore disks with no device X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/f0953bbd48a2310f6046b88e35c4f5950f13dda7?hp=ead6cfd31864333d1dddd7b54eb02e71964ccaa9 Ignore disks with no device --- diff --git a/cookbooks/hardware/recipes/default.rb b/cookbooks/hardware/recipes/default.rb index c29185248..0b7b3e6f3 100644 --- a/cookbooks/hardware/recipes/default.rb +++ b/cookbooks/hardware/recipes/default.rb @@ -311,11 +311,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 +326,8 @@ disks = node[:hardware][:disk][:disks].map do |disk| ] end +disks = disks.compact + if disks.count > 0 package "smartmontools"