From 9360c6961050e2730b750afc41ec3e240dda3f30 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 14 Dec 2015 11:57:59 +0000 Subject: [PATCH 1/1] Handle unknown BMC manufacturers better --- cookbooks/hardware/templates/default/ohai.rb.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cookbooks/hardware/templates/default/ohai.rb.erb b/cookbooks/hardware/templates/default/ohai.rb.erb index 21790a804..09a9bced0 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -796,7 +796,9 @@ Ohai.plugin(:Hardware) do device = {} IO.popen(["ipmitool", "mc", "info"]).each_with_object([]) do |line, devices| - if line =~ /(Product [A-Z ]+[A-Z])\s*:\s+(.*\S)\s+\(.*\)\s*$/i + if line =~ /(Manufacturer [A-Z ]+[A-Z])\s*:\s+(.*\S)\s+\(.*\)\s*$/i + device[Regexp.last_match(1).tr(" ", "_").downcase.to_sym] = Regexp.last_match(2) + elsif line =~ /(Product [A-Z ]+[A-Z])\s*:\s+(.*\S)\s+\(.*\)\s*$/i device[Regexp.last_match(1).tr(" ", "_").downcase.to_sym] = Regexp.last_match(2) elsif line =~ /([A-Z ]+[A-Z])\s*:\s+(.*\S)\s*$/i device[Regexp.last_match(1).tr(" ", "_").downcase.to_sym] = Regexp.last_match(2) -- 2.43.2