X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/cad29d0634cd10b0ee94e5e4974210e0ca01ae6f..9d63b4d5154d333e93d8ff317e1126a17ad1890f:/cookbooks/hardware/templates/default/ohai.rb.erb diff --git a/cookbooks/hardware/templates/default/ohai.rb.erb b/cookbooks/hardware/templates/default/ohai.rb.erb index 5f1cee9d7..63f4806d9 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -317,6 +317,8 @@ Ohai.plugin(:Hardware) do disk = nil IO.popen(%w(ssacli controller all show config detail)).each do |line| + next unless line.valid_encoding? + if line =~ /^Smart (?:Array|HBA) (\S+) / controller = { :id => devices[:controllers].count, @@ -377,6 +379,7 @@ Ohai.plugin(:Hardware) do elsif array && line =~ /^ Status:\s+(.*\S)\s*$/ case Regexp.last_match(1) when "OK" then array[:status] = "optimal" + when "Interim Recovery Mode" then array[:status] = "degraded" else array[:status] = "unknown" end elsif array && line =~ /^ (\S[^:]+):\s+(.*\S)\s*$/ @@ -446,11 +449,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