]> git.openstreetmap.org Git - chef.git/commitdiff
Fix PCI address identification for megaraid controllers
authorTom Hughes <tom@compton.nu>
Sun, 24 Jul 2022 18:31:18 +0000 (19:31 +0100)
committerTom Hughes <tom@compton.nu>
Sun, 24 Jul 2022 18:31:18 +0000 (19:31 +0100)
cookbooks/hardware/templates/default/ohai.rb.erb

index 5f1cee9d79d7fdd811015407528bfe16c36a5644..8c7d633ab166705bc274568e552e5cdd3a033703 100644 (file)
@@ -446,11 +446,11 @@ Ohai.plugin(:Hardware) do
         devices[:controllers] << controller
 
         controllers << controller
-      elsif line =~ /^Bus Number\s+:\s+(\d+)$/
+      elsif line =~ /^Bus Number\s+:\s+([0-9a-f]+)$/i
         controller[:pci_slot] = format "0000:%02x", Integer("0x#{Regexp.last_match(1)}")
-      elsif line =~ /^Device Number\s+:\s+(\d+)$/
+      elsif line =~ /^Device Number\s+:\s+([0-9a-f]+)$/i
         controller[:pci_slot] = format "%s:%02x", controller[:pci_slot], Integer("0x#{Regexp.last_match(1)}")
-      elsif line =~ /^Function Number\s+:\s+(\d+)$/
+      elsif line =~ /^Function Number\s+:\s+([0-9a-f]+)$/i
         controller[:pci_slot] = format "%s.%01x", controller[:pci_slot], Integer("0x#{Regexp.last_match(1)}")
       end
     end