summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2016-04-20 10:24:04 -0700
committerTim Smith <tsmith84@gmail.com>2016-04-20 10:24:04 -0700
commit3cfd06e9067fece7d12d37020e387fa04b2456df (patch)
treebf7c6933bfead1a7340c59e5f7c60bc9b4b2ee03
parentba549e9c5164762ffd4a9206ec798c52925dda1c (diff)
downloadohai-plugin_cleanup.tar.gz
Add additional logging to the C pluginplugin_cleanup
-rw-r--r--lib/ohai/plugins/c.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ohai/plugins/c.rb b/lib/ohai/plugins/c.rb
index 5f7887bc..e5107cdc 100644
--- a/lib/ohai/plugins/c.rb
+++ b/lib/ohai/plugins/c.rb
@@ -25,9 +25,13 @@ Ohai.plugin(:C) do
def collect(cmd, &block)
so = shell_out(cmd)
- yield(so) if so.exitstatus == 0
+ if so.exitstatus == 0
+ yield(so)
+ else
+ Ohai::Log.debug("Plugin C '#{cmd}' failed. Skipping data.")
+ end
rescue Ohai::Exceptions::Exec
- # ignore
+ Ohai::Log.debug("Plugin C '#{cmd}' binary could not be found. Skipping data.")
end
collect_data do
@@ -35,6 +39,12 @@ Ohai.plugin(:C) do
#gcc
collect("gcc -v") do |so|
+ # Sample output:
+ # Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
+ # Apple LLVM version 7.3.0 (clang-703.0.29)
+ # Target: x86_64-apple-darwin15.4.0
+ # Thread model: posix
+ # InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
description = so.stderr.split($/).last
output = description.split
if output.length >= 3