]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/hardware/recipes/default.rb
Ignore disks with no device
[chef.git] / cookbooks / hardware / recipes / default.rb
index c2918524826731b404840f47e351e5727cab8f85..0b7b3e6f3f88dfa03f1b656cc4304b3d9f223c17 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"