ohai 8.22.1 → 8.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ohai/application.rb +2 -0
- data/lib/ohai/mixin/dmi_decode.rb +2 -0
- data/lib/ohai/mixin/ec2_metadata.rb +14 -0
- data/lib/ohai/plugins/azure.rb +5 -5
- data/lib/ohai/plugins/c.rb +118 -46
- data/lib/ohai/plugins/cloud.rb +1 -0
- data/lib/ohai/plugins/dmi.rb +5 -5
- data/lib/ohai/plugins/ec2.rb +1 -0
- data/lib/ohai/plugins/erlang.rb +3 -5
- data/lib/ohai/plugins/groovy.rb +1 -1
- data/lib/ohai/plugins/haskell.rb +4 -4
- data/lib/ohai/plugins/hostname.rb +6 -6
- data/lib/ohai/plugins/ip_scopes.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +15 -15
- data/lib/ohai/plugins/linux/platform.rb +82 -43
- data/lib/ohai/plugins/linux/sessions.rb +2 -0
- data/lib/ohai/plugins/linux/virtualization.rb +18 -0
- data/lib/ohai/plugins/lua.rb +1 -1
- data/lib/ohai/plugins/network.rb +10 -10
- data/lib/ohai/plugins/scala.rb +2 -2
- data/lib/ohai/plugins/solaris2/dmi.rb +5 -5
- data/lib/ohai/plugins/sysconf.rb +45 -0
- data/lib/ohai/plugins/virtualbox.rb +22 -17
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/virtualization.rb +14 -0
- data/lib/ohai/system.rb +0 -4
- data/lib/ohai/util/file_helper.rb +2 -2
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/plugins/c_spec.rb +299 -266
- data/spec/unit/plugins/cloud_spec.rb +6 -0
- data/spec/unit/plugins/ec2_spec.rb +45 -1
- data/spec/unit/plugins/erlang_spec.rb +5 -5
- data/spec/unit/plugins/linux/network_spec.rb +1 -1
- data/spec/unit/plugins/linux/platform_spec.rb +43 -1
- data/spec/unit/plugins/linux/virtualization_spec.rb +19 -0
- data/spec/unit/plugins/network_spec.rb +23 -23
- data/spec/unit/plugins/sysconf_spec.rb +679 -0
- data/spec/unit/plugins/windows/virtualization_spec.rb +67 -0
- data/spec/unit/system_spec.rb +0 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89282c58ac1e24456ce207bd1a1c32fb0985ddb1
|
4
|
+
data.tar.gz: 3ba00373a8b89ebca6c67321df854d71191ab451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 838cfac284099378f5ca37317abe23598e7610370ca94406c3fbe98a9a775c955f40ec2c5391985a5a555a04317f0653d71a380c1e812d855810f8047b3dace4
|
7
|
+
data.tar.gz: e09dc27cc5ad660bfbd8433b72579a581ce979167c20063c9bfb2bfc12cdc2b741c65e1bbdf3457afacd41ee1f43b52f2f5f8d8b22e9d6d69049e47bc3562deb
|
data/lib/ohai/application.rb
CHANGED
@@ -200,6 +200,20 @@ module Ohai
|
|
200
200
|
response.code == "200" ? response.body : nil
|
201
201
|
end
|
202
202
|
|
203
|
+
def fetch_dynamic_data
|
204
|
+
@fetch_dynamic_data ||= begin
|
205
|
+
api_version = best_api_version
|
206
|
+
return {} if api_version.nil?
|
207
|
+
response = http_client.get("/#{api_version}/dynamic/instance-identity/document/")
|
208
|
+
|
209
|
+
if json?(response.body) && response.code == "200"
|
210
|
+
FFI_Yajl::Parser.parse(response.body)
|
211
|
+
else
|
212
|
+
{}
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
203
217
|
private
|
204
218
|
|
205
219
|
def expand_path(file_name)
|
data/lib/ohai/plugins/azure.rb
CHANGED
@@ -24,14 +24,14 @@ Ohai.plugin(:Azure) do
|
|
24
24
|
# project for details
|
25
25
|
azure_metadata_from_hints = hint?("azure")
|
26
26
|
if azure_metadata_from_hints
|
27
|
-
Ohai::Log.debug("
|
27
|
+
Ohai::Log.debug("Plugin Azure: azure_metadata_from_hints is present.")
|
28
28
|
azure Mash.new
|
29
29
|
azure_metadata_from_hints.each { |k, v| azure[k] = v }
|
30
30
|
elsif has_waagent? || has_dhcp_option_245?
|
31
|
-
Ohai::Log.debug("
|
31
|
+
Ohai::Log.debug("Plugin Azure: No hints present, but system appears to be on azure.")
|
32
32
|
azure Mash.new
|
33
33
|
else
|
34
|
-
Ohai::Log.debug("
|
34
|
+
Ohai::Log.debug("Plugin Azure: No hints present for azure and doesn't appear to be azure.")
|
35
35
|
false
|
36
36
|
end
|
37
37
|
end
|
@@ -40,7 +40,7 @@ Ohai.plugin(:Azure) do
|
|
40
40
|
# http://blog.mszcool.com/index.php/2015/04/detecting-if-a-virtual-machine-runs-in-microsoft-azure-linux-windows-to-protect-your-software-when-distributed-via-the-azure-marketplace/
|
41
41
|
def has_waagent?
|
42
42
|
if File.exist?("/usr/sbin/waagent") || Dir.exist?('C:\WindowsAzure')
|
43
|
-
Ohai::Log.debug("
|
43
|
+
Ohai::Log.debug("Plugin Azure: Found waagent used by MS Azure.")
|
44
44
|
return true
|
45
45
|
end
|
46
46
|
end
|
@@ -50,7 +50,7 @@ Ohai.plugin(:Azure) do
|
|
50
50
|
if File.exist?("/var/lib/dhcp/dhclient.eth0.leases")
|
51
51
|
File.open("/var/lib/dhcp/dhclient.eth0.leases").each do |line|
|
52
52
|
if line =~ /unknown-245/
|
53
|
-
Ohai::Log.debug("
|
53
|
+
Ohai::Log.debug("Plugin Azure: Found unknown-245 DHCP option used by MS Azure.")
|
54
54
|
has_245 = true
|
55
55
|
break
|
56
56
|
end
|
data/lib/ohai/plugins/c.rb
CHANGED
@@ -16,11 +16,8 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require "rbconfig"
|
20
|
-
|
21
19
|
Ohai.plugin(:C) do
|
22
20
|
provides "languages/c"
|
23
|
-
|
24
21
|
depends "languages"
|
25
22
|
|
26
23
|
def collect(cmd, &block)
|
@@ -28,100 +25,175 @@ Ohai.plugin(:C) do
|
|
28
25
|
if so.exitstatus == 0
|
29
26
|
yield(so)
|
30
27
|
else
|
31
|
-
Ohai::Log.debug("Plugin C '#{cmd}' failed. Skipping data.")
|
28
|
+
Ohai::Log.debug("Plugin C: '#{cmd}' failed. Skipping data.")
|
32
29
|
end
|
33
30
|
rescue Ohai::Exceptions::Exec
|
34
|
-
Ohai::Log.debug("Plugin C '#{cmd}' binary could not be found. Skipping data.")
|
31
|
+
Ohai::Log.debug("Plugin C: '#{cmd}' binary could not be found. Skipping data.")
|
35
32
|
end
|
36
33
|
|
37
|
-
|
38
|
-
|
34
|
+
def xcode_installed?
|
35
|
+
Ohai::Log.debug("Plugin C: Checking for Xcode Command Line Tools.")
|
36
|
+
so = shell_out("/usr/bin/xcode-select -p")
|
37
|
+
if so.exitstatus == 0
|
38
|
+
Ohai::Log.debug("Plugin C: Xcode Command Line Tools found.")
|
39
|
+
return true
|
40
|
+
else
|
41
|
+
Ohai::Log.debug("Plugin C: Xcode Command Line Tools not found.")
|
42
|
+
return false
|
43
|
+
end
|
44
|
+
rescue Ohai::Exceptions::Exec
|
45
|
+
Ohai::Log.debug("Plugin C: xcode-select binary could not be found. Skipping data.")
|
46
|
+
end
|
39
47
|
|
40
|
-
|
48
|
+
def collect_gcc
|
49
|
+
# gcc
|
50
|
+
# Sample output on os x:
|
51
|
+
# Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
|
52
|
+
# Apple LLVM version 7.3.0 (clang-703.0.29)
|
53
|
+
# Target: x86_64-apple-darwin15.4.0
|
54
|
+
# Thread model: posix
|
55
|
+
# InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
|
56
|
+
#
|
57
|
+
#
|
58
|
+
# Sample output on Linux:
|
59
|
+
# Using built-in specs.
|
60
|
+
# COLLECT_GCC=gcc
|
61
|
+
# COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
|
62
|
+
# Target: x86_64-linux-gnu
|
63
|
+
# Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
|
64
|
+
# Thread model: posix
|
65
|
+
# gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
|
66
|
+
gcc = Mash.new
|
41
67
|
collect("gcc -v") do |so|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
68
|
+
so.stderr.each_line do |line|
|
69
|
+
case line
|
70
|
+
when /^(.*version\s(\S*).*)/
|
71
|
+
gcc[:description] = $1
|
72
|
+
gcc[:version] = $2
|
73
|
+
when /^Target:\s(.*)/
|
74
|
+
gcc[:target] = $1
|
75
|
+
when /^Configured with:\s(.*)/
|
76
|
+
gcc[:configured_with] = $1
|
77
|
+
when /^Thread model:\s(.*)/
|
78
|
+
gcc[:thread_model] = $1
|
79
|
+
end
|
54
80
|
end
|
55
81
|
end
|
82
|
+
@c[:gcc] = gcc unless gcc.empty?
|
83
|
+
end
|
56
84
|
|
57
|
-
|
85
|
+
def collect_glibc
|
86
|
+
# glibc
|
58
87
|
["/lib/libc.so.6", "/lib64/libc.so.6"].each do |glibc|
|
59
88
|
collect( Ohai.abs_path( glibc )) do |so|
|
60
89
|
description = so.stdout.split($/).first
|
61
90
|
if description =~ /(\d+\.\d+\.?\d*)/
|
62
|
-
c[:glibc] = Mash.new
|
63
|
-
c[:glibc][:version] = $1
|
64
|
-
c[:glibc][:description] = description
|
91
|
+
@c[:glibc] = Mash.new
|
92
|
+
@c[:glibc][:version] = $1
|
93
|
+
@c[:glibc][:description] = description
|
65
94
|
end
|
66
|
-
end
|
95
|
+
end
|
67
96
|
end
|
97
|
+
end
|
68
98
|
|
69
|
-
|
99
|
+
def check_for_cl
|
100
|
+
# ms cl
|
70
101
|
collect("cl /?") do |so|
|
71
102
|
description = so.stderr.lines.first.chomp
|
72
103
|
if description =~ /Compiler Version ([\d\.]+)/
|
73
|
-
c[:cl] = Mash.new
|
74
|
-
c[:cl][:version] = $1
|
75
|
-
c[:cl][:description] = description
|
104
|
+
@c[:cl] = Mash.new
|
105
|
+
@c[:cl][:version] = $1
|
106
|
+
@c[:cl][:description] = description
|
76
107
|
end
|
77
108
|
end
|
109
|
+
end
|
78
110
|
|
79
|
-
|
111
|
+
def check_for_devenv
|
112
|
+
# ms vs
|
80
113
|
collect("devenv.com /?") do |so|
|
81
114
|
lines = so.stdout.split($/)
|
82
115
|
description = lines[0].length == 0 ? lines[1] : lines[0]
|
83
116
|
if description =~ /Visual Studio Version ([\d\.]+)/
|
84
|
-
c[:vs] = Mash.new
|
85
|
-
c[:vs][:version] = $1.chop
|
86
|
-
c[:vs][:description] = description
|
117
|
+
@c[:vs] = Mash.new
|
118
|
+
@c[:vs][:version] = $1.chop
|
119
|
+
@c[:vs][:description] = description
|
87
120
|
end
|
88
121
|
end
|
122
|
+
end
|
89
123
|
|
90
|
-
|
124
|
+
def collect_xlc
|
125
|
+
# ibm xlc
|
91
126
|
begin
|
92
127
|
so = shell_out("xlc -qversion")
|
93
128
|
if so.exitstatus == 0 || (so.exitstatus >> 8) == 249
|
94
129
|
description = so.stdout.split($/).first
|
95
130
|
if description =~ /V(\d+\.\d+)/
|
96
|
-
c[:xlc] = Mash.new
|
97
|
-
c[:xlc][:version] = $1
|
98
|
-
c[:xlc][:description] = description.strip
|
131
|
+
@c[:xlc] = Mash.new
|
132
|
+
@c[:xlc][:version] = $1
|
133
|
+
@c[:xlc][:description] = description.strip
|
99
134
|
end
|
100
135
|
end
|
101
136
|
rescue Ohai::Exceptions::Exec
|
102
137
|
end
|
138
|
+
end
|
103
139
|
|
104
|
-
|
140
|
+
def collect_sunpro
|
141
|
+
# sun pro
|
105
142
|
collect("cc -V -flags") do |so|
|
106
143
|
output = so.stderr.split
|
107
144
|
if so.stderr =~ /^cc: Sun C/ && output.size >= 4
|
108
|
-
c[:sunpro] = Mash.new
|
109
|
-
c[:sunpro][:version] = output[3]
|
110
|
-
c[:sunpro][:description] = so.stderr.chomp
|
145
|
+
@c[:sunpro] = Mash.new
|
146
|
+
@c[:sunpro][:version] = output[3]
|
147
|
+
@c[:sunpro][:description] = so.stderr.chomp
|
111
148
|
end
|
112
149
|
end
|
150
|
+
end
|
113
151
|
|
114
|
-
|
152
|
+
def collect_hpux_cc
|
153
|
+
# hpux cc
|
115
154
|
collect("what /opt/ansic/bin/cc") do |so|
|
116
155
|
description = so.stdout.split($/).select { |line| line =~ /HP C Compiler/ }.first
|
117
156
|
if description
|
118
157
|
output = description.split
|
119
|
-
c[:hpcc] = Mash.new
|
120
|
-
c[:hpcc][:version] = output[1] if output.size >= 1
|
121
|
-
c[:hpcc][:description] = description.strip
|
158
|
+
@c[:hpcc] = Mash.new
|
159
|
+
@c[:hpcc][:version] = output[1] if output.size >= 1
|
160
|
+
@c[:hpcc][:description] = description.strip
|
122
161
|
end
|
123
162
|
end
|
163
|
+
end
|
164
|
+
|
165
|
+
collect_data(:aix) do
|
166
|
+
@c = Mash.new
|
167
|
+
collect_xlc
|
168
|
+
collect_gcc
|
169
|
+
languages[:c] = @c unless @c.empty?
|
170
|
+
end
|
171
|
+
|
172
|
+
collect_data(:darwin) do
|
173
|
+
@c = Mash.new
|
174
|
+
collect_gcc if xcode_installed?
|
175
|
+
languages[:c] = @c unless @c.empty?
|
176
|
+
end
|
177
|
+
|
178
|
+
collect_data(:windows) do
|
179
|
+
@c = Mash.new
|
180
|
+
check_for_cl
|
181
|
+
check_for_devenv
|
182
|
+
languages[:c] = @c unless @c.empty?
|
183
|
+
end
|
184
|
+
|
185
|
+
collect_data(:hpux) do
|
186
|
+
@c = Mash.new
|
187
|
+
collect_gcc
|
188
|
+
collect_hpux_cc
|
189
|
+
languages[:c] = @c unless @c.empty?
|
190
|
+
end
|
124
191
|
|
125
|
-
|
192
|
+
collect_data(:default) do
|
193
|
+
@c = Mash.new
|
194
|
+
collect_gcc
|
195
|
+
collect_glibc
|
196
|
+
collect_sunpro
|
197
|
+
languages[:c] = @c unless @c.empty?
|
126
198
|
end
|
127
199
|
end
|
data/lib/ohai/plugins/cloud.rb
CHANGED
@@ -208,6 +208,7 @@ Ohai.plugin(:Cloud) do
|
|
208
208
|
# Fill cloud hash with azure values
|
209
209
|
def get_azure_values
|
210
210
|
cloud[:vm_name] = azure["vm_name"]
|
211
|
+
cloud[:private_ips] << azure["private_ip"]
|
211
212
|
cloud[:public_ips] << azure["public_ip"]
|
212
213
|
cloud[:public_ipv4] = azure["public_ip"]
|
213
214
|
cloud[:public_fqdn] = azure["public_fqdn"]
|
data/lib/ohai/plugins/dmi.rb
CHANGED
@@ -92,14 +92,14 @@ Ohai.plugin(:DMI) do
|
|
92
92
|
|
93
93
|
elsif type = type_line.match(line)
|
94
94
|
if dmi_record == nil
|
95
|
-
Ohai::Log.debug("unexpected data line found before header; discarding:\n#{line}")
|
95
|
+
Ohai::Log.debug("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
|
96
96
|
next
|
97
97
|
end
|
98
98
|
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][:application_identifier] = type[1]
|
99
99
|
|
100
100
|
elsif data = data_line.match(line)
|
101
101
|
if dmi_record == nil
|
102
|
-
Ohai::Log.debug("unexpected data line found before header; discarding:\n#{line}")
|
102
|
+
Ohai::Log.debug("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
|
103
103
|
next
|
104
104
|
end
|
105
105
|
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][data[1]] = data[2]
|
@@ -107,11 +107,11 @@ Ohai.plugin(:DMI) do
|
|
107
107
|
|
108
108
|
elsif extended_data = extended_data_line.match(line)
|
109
109
|
if dmi_record == nil
|
110
|
-
Ohai::Log.debug("unexpected extended data line found before header; discarding:\n#{line}")
|
110
|
+
Ohai::Log.debug("Plugin DMI: unexpected extended data line found before header; discarding:\n#{line}")
|
111
111
|
next
|
112
112
|
end
|
113
113
|
if field == nil
|
114
|
-
Ohai::Log.debug("unexpected extended data line found outside data section; discarding:\n#{line}")
|
114
|
+
Ohai::Log.debug("Plugin DMI: unexpected extended data line found outside data section; discarding:\n#{line}")
|
115
115
|
next
|
116
116
|
end
|
117
117
|
# overwrite "raw" value with a new Mash
|
@@ -119,7 +119,7 @@ Ohai.plugin(:DMI) do
|
|
119
119
|
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][field][extended_data[1]] = nil
|
120
120
|
|
121
121
|
else
|
122
|
-
Ohai::Log.debug("unrecognized output line; discarding:\n#{line}")
|
122
|
+
Ohai::Log.debug("Plugin DMI: unrecognized output line; discarding:\n#{line}")
|
123
123
|
|
124
124
|
end
|
125
125
|
end
|
data/lib/ohai/plugins/ec2.rb
CHANGED
@@ -96,6 +96,7 @@ Ohai.plugin(:EC2) do
|
|
96
96
|
ec2[k] = v
|
97
97
|
end
|
98
98
|
ec2[:userdata] = fetch_userdata
|
99
|
+
ec2[:account_id] = fetch_dynamic_data["accountId"]
|
99
100
|
# ASCII-8BIT is equivalent to BINARY in this case
|
100
101
|
if ec2[:userdata] && ec2[:userdata].encoding.to_s == "ASCII-8BIT"
|
101
102
|
Ohai::Log.debug("Plugin EC2: Binary UserData Found. Storing in base64")
|
data/lib/ohai/plugins/erlang.rb
CHANGED
@@ -24,13 +24,11 @@ Ohai.plugin(:Erlang) do
|
|
24
24
|
erlang = Mash.new
|
25
25
|
|
26
26
|
begin
|
27
|
-
so = shell_out("erl -eval '
|
27
|
+
so = shell_out("erl -eval '{ok, Ver} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), Vsn = binary:bin_to_list(Ver, {0, byte_size(Ver) - 1}), io:format(\"~s,~s,~s\", [Vsn, erlang:system_info(version), erlang:system_info(nif_version)]), halt().' -noshell")
|
28
28
|
# Sample output:
|
29
|
-
#
|
30
|
-
# "7.3"
|
31
|
-
# "2.10"
|
29
|
+
# 19.1,8.1,2.11
|
32
30
|
if so.exitstatus == 0
|
33
|
-
output = so.stdout.split(
|
31
|
+
output = so.stdout.split(",")
|
34
32
|
erlang[:version] = output[0]
|
35
33
|
erlang[:erts_version] = output[1]
|
36
34
|
erlang[:nif_version] = output[2]
|
data/lib/ohai/plugins/groovy.rb
CHANGED
@@ -32,7 +32,7 @@ Ohai.plugin(:Groovy) do
|
|
32
32
|
languages[:groovy] = groovy
|
33
33
|
end
|
34
34
|
rescue Ohai::Exceptions::Exec
|
35
|
-
Ohai::Log.debug('Groovy
|
35
|
+
Ohai::Log.debug('Plugin Groovy: Could not shell_out "groovy -v". Skipping plugin')
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/lib/ohai/plugins/haskell.rb
CHANGED
@@ -39,7 +39,7 @@ Ohai.plugin(:Haskell) do
|
|
39
39
|
haskell[:ghc][:description] = so.stdout.chomp
|
40
40
|
end
|
41
41
|
rescue Ohai::Exceptions::Exec
|
42
|
-
Ohai::Log.debug('Haskell
|
42
|
+
Ohai::Log.debug('Plugin Haskell: Could not shell_out "ghc --version". Skipping data')
|
43
43
|
end
|
44
44
|
|
45
45
|
# Check for ghci
|
@@ -54,7 +54,7 @@ Ohai.plugin(:Haskell) do
|
|
54
54
|
haskell[:ghci][:description] = so.stdout.chomp
|
55
55
|
end
|
56
56
|
rescue Ohai::Exceptions::Exec
|
57
|
-
Ohai::Log.debug('Haskell
|
57
|
+
Ohai::Log.debug('Plugin Haskell: Could not shell_out "ghci --version". Skipping data')
|
58
58
|
end
|
59
59
|
|
60
60
|
# Check for cabal
|
@@ -70,7 +70,7 @@ Ohai.plugin(:Haskell) do
|
|
70
70
|
haskell[:cabal][:description] = so.stdout.split("\n")[0].chomp
|
71
71
|
end
|
72
72
|
rescue Ohai::Exceptions::Exec
|
73
|
-
Ohai::Log.debug('Haskell
|
73
|
+
Ohai::Log.debug('Plugin Haskell: Could not shell_out "cabal --version". Skipping data')
|
74
74
|
end
|
75
75
|
|
76
76
|
# Check for stack
|
@@ -87,7 +87,7 @@ Ohai.plugin(:Haskell) do
|
|
87
87
|
haskell[:stack][:description] = so.stdout.chomp
|
88
88
|
end
|
89
89
|
rescue Ohai::Exceptions::Exec
|
90
|
-
Ohai::Log.debug('Haskell
|
90
|
+
Ohai::Log.debug('Plugin Haskell: Could not shell_out "stack --version". Skipping data')
|
91
91
|
end
|
92
92
|
|
93
93
|
languages[:haskell] = haskell unless haskell.empty?
|
@@ -120,19 +120,19 @@ Ohai.plugin(:Hostname) do
|
|
120
120
|
# Sometimes... very rarely, but sometimes, 'hostname --fqdn' falsely
|
121
121
|
# returns a blank string. WTF.
|
122
122
|
if ourfqdn.nil? || ourfqdn.empty?
|
123
|
-
Ohai::Log.debug("hostname returned an empty string, retrying once.")
|
123
|
+
Ohai::Log.debug("Plugin Hostname: hostname returned an empty string, retrying once.")
|
124
124
|
ourfqdn = resolve_fqdn
|
125
125
|
end
|
126
126
|
|
127
127
|
if ourfqdn.nil? || ourfqdn.empty?
|
128
|
-
Ohai::Log.debug("hostname returned an empty string twice and will" +
|
128
|
+
Ohai::Log.debug("Plugin Hostname: hostname returned an empty string twice and will" +
|
129
129
|
"not be set.")
|
130
130
|
else
|
131
131
|
fqdn ourfqdn
|
132
132
|
end
|
133
133
|
rescue
|
134
134
|
Ohai::Log.debug(
|
135
|
-
"hostname returned an error, probably no domain set")
|
135
|
+
"Plugin Hostname: hostname returned an error, probably no domain set")
|
136
136
|
end
|
137
137
|
domain collect_domain
|
138
138
|
end
|
@@ -152,20 +152,20 @@ Ohai.plugin(:Hostname) do
|
|
152
152
|
# Sometimes... very rarely, but sometimes, 'hostname --fqdn' falsely
|
153
153
|
# returns a blank string. WTF.
|
154
154
|
if ourfqdn.nil? || ourfqdn.empty?
|
155
|
-
Ohai::Log.debug("hostname --fqdn returned an empty string, retrying " +
|
155
|
+
Ohai::Log.debug("Plugin Hostname: hostname --fqdn returned an empty string, retrying " +
|
156
156
|
"once.")
|
157
157
|
ourfqdn = from_cmd("hostname --fqdn")
|
158
158
|
end
|
159
159
|
|
160
160
|
if ourfqdn.nil? || ourfqdn.empty?
|
161
|
-
Ohai::Log.debug("hostname --fqdn returned an empty string twice and " +
|
161
|
+
Ohai::Log.debug("Plugin Hostname: hostname --fqdn returned an empty string twice and " +
|
162
162
|
"will not be set.")
|
163
163
|
else
|
164
164
|
fqdn ourfqdn
|
165
165
|
end
|
166
166
|
rescue
|
167
167
|
Ohai::Log.debug(
|
168
|
-
"hostname --fqdn returned an error, probably no domain set")
|
168
|
+
"Plugin Hostname: hostname --fqdn returned an error, probably no domain set")
|
169
169
|
end
|
170
170
|
domain collect_domain
|
171
171
|
end
|