Ignore disks with no device
authorTom Hughes <tom@compton.nu>
Tue, 22 Dec 2015 22:34:25 +0000 (22:34 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 22 Dec 2015 22:38:07 +0000 (22:38 +0000)
cookbooks/hardware/recipes/default.rb

index c291852..0b7b3e6 100644 (file)
@@ -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"