summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-11-06 12:56:15 -0800
committerGitHub <noreply@github.com>2020-11-06 12:56:15 -0800
commit73bcf6abe6b7520c45a51afc445a6a2f78a7f4ea (patch)
tree4a5fcc2476574b56366dab0db6d7910235aaee42
parent0a2584c4ef7120031d97beb3b05e833ec4cb5857 (diff)
parent00153175b5e9ec7386e57d1d95bd4cd60f91fa5d (diff)
downloadohai-73bcf6abe6b7520c45a51afc445a6a2f78a7f4ea.tar.gz
Merge pull request #1558 from chef/speedup
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/ohai/plugins/cpu.rb4
-rw-r--r--lib/ohai/plugins/darwin/memory.rb4
-rw-r--r--lib/ohai/runner.rb4
3 files changed, 3 insertions, 9 deletions
diff --git a/lib/ohai/plugins/cpu.rb b/lib/ohai/plugins/cpu.rb
index 9cbb7abb..66aa1260 100644
--- a/lib/ohai/plugins/cpu.rb
+++ b/lib/ohai/plugins/cpu.rb
@@ -36,11 +36,9 @@ Ohai.plugin(:CPU) do
when /CPU:\s+(.+) \(([\d.]+).+\)/
cpuinfo["model_name"] = $1
cpuinfo["mhz"] = $2
- when /Features=.+<(.+)>/
+ when /Features=.+<(.+)>/, /Features2=[a-f\dx]+<(.+)>/
cpuinfo["flags"].concat($1.downcase.split(","))
# Features2=0x80000001<SSE3,<b31>>
- when /Features2=[a-f\dx]+<(.+)>/
- cpuinfo["flags"].concat($1.downcase.split(","))
else
yield(cpuinfo, line)
end
diff --git a/lib/ohai/plugins/darwin/memory.rb b/lib/ohai/plugins/darwin/memory.rb
index d76bd5db..72a6e69f 100644
--- a/lib/ohai/plugins/darwin/memory.rb
+++ b/lib/ohai/plugins/darwin/memory.rb
@@ -44,9 +44,7 @@ Ohai.plugin(:Memory) do
megabyte_val = (pages * page_size) / 1024 / 1024.0
total_consumed += megabyte_val
case match
- when "wired down"
- active += megabyte_val.to_i
- when "active"
+ when "wired down", "active"
active += megabyte_val.to_i
when "inactive"
inactive += megabyte_val.to_i
diff --git a/lib/ohai/runner.rb b/lib/ohai/runner.rb
index f9dd248f..02c30a19 100644
--- a/lib/ohai/runner.rb
+++ b/lib/ohai/runner.rb
@@ -58,9 +58,7 @@ module Ohai
else
raise Ohai::Exceptions::InvalidPlugin, "Invalid plugin version #{plugin.version} for plugin #{plugin}"
end
- rescue Ohai::Exceptions::Error # rubocop: disable Lint/ShadowedException
- raise
- rescue SystemExit # abort or exit from plug-in should exit Ohai with failure code
+ rescue Ohai::Exceptions::Error, SystemExit # SystemExit: abort or exit from plug-in should exit Ohai with failure code
raise
rescue Exception => e
logger.trace("Plugin #{plugin.name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")