Avoid exception for disks with no model
authorTom Hughes <tom@compton.nu>
Tue, 7 Jun 2016 15:10:46 +0000 (16:10 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 7 Jun 2016 15:14:12 +0000 (16:14 +0100)
cookbooks/hardware/templates/default/ohai.rb.erb

index e83343a..8192d34 100644 (file)
@@ -180,7 +180,7 @@ Ohai.plugin(:Hardware) do
         end
       end
 
-      disk[:model].sub!(/-.*$/, "")
+      disk[:model].sub!(/-.*$/, "") if disk[:model]
     end
 
     disk