ohai 16.3.2 → 16.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/lib/ohai/application.rb +2 -2
- data/lib/ohai/loader.rb +1 -2
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/mixin/os.rb +1 -1
- data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
- data/lib/ohai/plugins/aix/network.rb +2 -1
- data/lib/ohai/plugins/aix/uptime.rb +1 -1
- data/lib/ohai/plugins/cloud.rb +1 -1
- data/lib/ohai/plugins/cpu.rb +1 -1
- data/lib/ohai/plugins/docker.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/platform.rb +2 -4
- data/lib/ohai/plugins/ec2.rb +3 -2
- data/lib/ohai/plugins/filesystem.rb +7 -13
- data/lib/ohai/plugins/fips.rb +1 -5
- data/lib/ohai/plugins/freebsd/platform.rb +2 -4
- data/lib/ohai/plugins/gce.rb +1 -1
- data/lib/ohai/plugins/hostname.rb +4 -4
- data/lib/ohai/plugins/kernel.rb +1 -1
- data/lib/ohai/plugins/linux/hostnamectl.rb +1 -2
- data/lib/ohai/plugins/linux/lsb.rb +1 -2
- data/lib/ohai/plugins/linux/lspci.rb +1 -2
- data/lib/ohai/plugins/linux/machineid.rb +2 -2
- data/lib/ohai/plugins/linux/network.rb +11 -3
- data/lib/ohai/plugins/linux/platform.rb +14 -17
- data/lib/ohai/plugins/netbsd/network.rb +4 -8
- data/lib/ohai/plugins/netbsd/platform.rb +2 -4
- data/lib/ohai/plugins/network.rb +4 -3
- data/lib/ohai/plugins/openbsd/network.rb +4 -8
- data/lib/ohai/plugins/openbsd/platform.rb +2 -4
- data/lib/ohai/plugins/openstack.rb +2 -1
- data/lib/ohai/plugins/packages.rb +1 -1
- data/lib/ohai/plugins/passwd.rb +2 -1
- data/lib/ohai/plugins/rackspace.rb +3 -2
- data/lib/ohai/plugins/root_group.rb +1 -1
- data/lib/ohai/plugins/ruby.rb +4 -15
- data/lib/ohai/plugins/scaleway.rb +1 -1
- data/lib/ohai/plugins/shard.rb +1 -1
- data/lib/ohai/plugins/solaris2/dmi.rb +2 -3
- data/lib/ohai/plugins/solaris2/memory.rb +1 -2
- data/lib/ohai/plugins/solaris2/network.rb +2 -6
- data/lib/ohai/plugins/solaris2/platform.rb +1 -2
- data/lib/ohai/plugins/solaris2/virtualization.rb +2 -5
- data/lib/ohai/plugins/uptime.rb +1 -1
- data/lib/ohai/plugins/windows/dmi.rb +2 -2
- data/lib/ohai/plugins/windows/drivers.rb +1 -1
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +1 -1
- data/lib/ohai/plugins/windows/virtualization.rb +1 -1
- data/lib/ohai/runner.rb +1 -1
- data/lib/ohai/util/ip_helper.rb +2 -2
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68766eeef1353df87e6a89c047bfe2d056be75698cf3e5db73f093a0d40059c5
|
|
4
|
+
data.tar.gz: 39b483600849fe31706da87bf2c70eda6a7fa7dec69f1155d12ce49e124581c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7730a85e74744663d1d7d282e07dbc249a4be8cfa0be63ee68b0e2fc09140c4053c0a97892295fcbf769c7653327898f77d1df482eb08734ce791cf4f6713aba
|
|
7
|
+
data.tar.gz: a299e3ebccb093d8bde8a0941ece0e8f085b496610623265e149aeefb545020cbfb497db85de53d0e1e1c640d2edce8f724b508d467d1cfdbbbea35a1edc0ef7
|
data/Gemfile
CHANGED
|
@@ -5,6 +5,7 @@ gemspec
|
|
|
5
5
|
# NOTE: do not submit PRs to add pry as a dep, add to your Gemfile.local
|
|
6
6
|
group :development do
|
|
7
7
|
gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
|
|
8
|
+
gem "rubocop-performance", "1.7.1"
|
|
8
9
|
gem "rake", ">= 10.1.0"
|
|
9
10
|
gem "rspec-core", "~> 3.0"
|
|
10
11
|
gem "rspec-expectations", "~> 3.0"
|
|
@@ -24,4 +25,4 @@ group :debug do
|
|
|
24
25
|
gem "pry-byebug"
|
|
25
26
|
gem "pry-stack_explorer", "~> 0.4.0" # pin until we drop ruby < 2.6
|
|
26
27
|
gem "rb-readline"
|
|
27
|
-
end
|
|
28
|
+
end
|
data/lib/ohai/application.rb
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
require "chef-config/path_helper"
|
|
19
19
|
require "chef-config/workstation_config_loader"
|
|
20
20
|
require_relative "../ohai"
|
|
21
|
-
require_relative "log"
|
|
21
|
+
require_relative "log" unless defined?(Ohai::Log)
|
|
22
22
|
require "mixlib/cli" unless defined?(Mixlib::CLI)
|
|
23
|
-
require "benchmark"
|
|
23
|
+
require "benchmark" unless defined?(Benchmark)
|
|
24
24
|
|
|
25
25
|
# The Application class is what is called by the Ohai CLI binary. It handles:
|
|
26
26
|
# - CLI options and attribute arguments
|
data/lib/ohai/loader.rb
CHANGED
|
@@ -71,8 +71,7 @@ module Ohai
|
|
|
71
71
|
from = [ Ohai.config[:plugin_path], from].flatten
|
|
72
72
|
plugin_files_by_dir(from).collect do |plugin_file|
|
|
73
73
|
logger.trace "Loading additional plugin: #{plugin_file}"
|
|
74
|
-
|
|
75
|
-
load_v7_plugin(plugin)
|
|
74
|
+
load_v7_plugin(load_plugin_class(plugin_file))
|
|
76
75
|
end
|
|
77
76
|
end
|
|
78
77
|
|
data/lib/ohai/log.rb
CHANGED
data/lib/ohai/mixin/os.rb
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
# See the License for the specific language governing permissions and
|
|
18
18
|
# limitations under the License.
|
|
19
19
|
|
|
20
|
-
require "net/
|
|
20
|
+
require "net/http" unless defined?(Net::HTTP)
|
|
21
21
|
require "uri" unless defined?(URI)
|
|
22
22
|
|
|
23
23
|
# https://softlayer.github.io/reference/services/SoftLayer_Resource_Metadata/
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
#
|
|
20
20
|
|
|
21
21
|
Ohai.plugin(:Network) do
|
|
22
|
-
require "ipaddr"
|
|
23
22
|
require_relative "../../mixin/network_helper"
|
|
24
23
|
|
|
25
24
|
provides "network", "counters/network", "macaddress"
|
|
@@ -27,6 +26,8 @@ Ohai.plugin(:Network) do
|
|
|
27
26
|
include Ohai::Mixin::NetworkHelper
|
|
28
27
|
|
|
29
28
|
collect_data(:aix) do
|
|
29
|
+
require "ipaddr" unless defined?(IPAddr)
|
|
30
|
+
|
|
30
31
|
# Loads following information.
|
|
31
32
|
# :default_interface, :default_gateway - route -n get 0
|
|
32
33
|
# :interfaces
|
|
@@ -21,7 +21,7 @@ Ohai.plugin(:Uptime) do
|
|
|
21
21
|
provides "uptime", "uptime_seconds"
|
|
22
22
|
|
|
23
23
|
collect_data(:aix) do
|
|
24
|
-
require "date"
|
|
24
|
+
require "date" unless defined?(DateTime)
|
|
25
25
|
# below we're going to assume that PID 1 is init (this is true 99.99999% of the time)
|
|
26
26
|
# output will look like this
|
|
27
27
|
# 1148-20:54:50
|
data/lib/ohai/plugins/cloud.rb
CHANGED
data/lib/ohai/plugins/cpu.rb
CHANGED
data/lib/ohai/plugins/docker.rb
CHANGED
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
#
|
|
17
17
|
|
|
18
18
|
Ohai.plugin(:Docker) do
|
|
19
|
-
require "json"
|
|
20
|
-
|
|
21
19
|
provides "docker"
|
|
22
20
|
depends "virtualization"
|
|
23
21
|
|
|
@@ -50,6 +48,8 @@ Ohai.plugin(:Docker) do
|
|
|
50
48
|
end
|
|
51
49
|
|
|
52
50
|
collect_data do
|
|
51
|
+
require "json" unless defined?(JSON)
|
|
52
|
+
|
|
53
53
|
if virtualization[:systems][:docker]
|
|
54
54
|
docker_ohai_data(docker_info_json)
|
|
55
55
|
end
|
|
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
|
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
|
21
21
|
|
|
22
22
|
collect_data(:dragonflybsd) do
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
so = shell_out("uname -r")
|
|
26
|
-
platform_version so.stdout.split($/)[0]
|
|
23
|
+
platform shell_out("uname -s").stdout.split($/)[0].downcase
|
|
24
|
+
platform_version shell_out("uname -r").stdout.split($/)[0]
|
|
27
25
|
platform_family "dragonflybsd"
|
|
28
26
|
end
|
|
29
27
|
end
|
data/lib/ohai/plugins/ec2.rb
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
Ohai.plugin(:EC2) do
|
|
29
29
|
require_relative "../mixin/ec2_metadata"
|
|
30
30
|
require_relative "../mixin/http_helper"
|
|
31
|
-
require "base64"
|
|
32
31
|
|
|
33
32
|
include Ohai::Mixin::Ec2Metadata
|
|
34
33
|
include Ohai::Mixin::HttpHelper
|
|
@@ -82,7 +81,7 @@ Ohai.plugin(:EC2) do
|
|
|
82
81
|
# @return [Boolean] do we have a Xen Identifying Number or not?
|
|
83
82
|
def has_ec2_identifying_number?
|
|
84
83
|
if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
|
85
|
-
require "wmi-lite/wmi"
|
|
84
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
86
85
|
wmi = WmiLite::Wmi.new
|
|
87
86
|
if /^ec2/.match?(wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"])
|
|
88
87
|
logger.trace("Plugin EC2: has_ec2_identifying_number? == true")
|
|
@@ -115,6 +114,8 @@ Ohai.plugin(:EC2) do
|
|
|
115
114
|
end
|
|
116
115
|
|
|
117
116
|
collect_data do
|
|
117
|
+
require "base64"
|
|
118
|
+
|
|
118
119
|
if looks_like_ec2?
|
|
119
120
|
logger.trace("Plugin EC2: looks_like_ec2? == true")
|
|
120
121
|
ec2 Mash.new
|
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
# limitations under the License.
|
|
24
24
|
#
|
|
25
25
|
|
|
26
|
-
require "set"
|
|
27
|
-
|
|
28
26
|
Ohai.plugin(:Filesystem) do
|
|
29
27
|
provides "filesystem"
|
|
30
28
|
|
|
@@ -286,12 +284,10 @@ Ohai.plugin(:Filesystem) do
|
|
|
286
284
|
|
|
287
285
|
# Grab filesystem data from df
|
|
288
286
|
run_with_check("df") do
|
|
289
|
-
|
|
290
|
-
fs.merge!(parse_common_df(so.stdout))
|
|
287
|
+
fs.merge!(parse_common_df(shell_out("df -P").stdout))
|
|
291
288
|
|
|
292
289
|
# Grab filesystem inode data from df
|
|
293
|
-
|
|
294
|
-
so.stdout.each_line do |line|
|
|
290
|
+
shell_out("df -iP").stdout.each_line do |line|
|
|
295
291
|
case line
|
|
296
292
|
when /^Filesystem\s+Inodes/
|
|
297
293
|
next
|
|
@@ -310,8 +306,7 @@ Ohai.plugin(:Filesystem) do
|
|
|
310
306
|
|
|
311
307
|
# Grab mount information from /bin/mount
|
|
312
308
|
run_with_check("mount") do
|
|
313
|
-
|
|
314
|
-
so.stdout.each_line do |line|
|
|
309
|
+
shell_out("mount").stdout.each_line do |line|
|
|
315
310
|
if line =~ /^(.+?) on (.+?) type (.+?) \((.+?)\)$/
|
|
316
311
|
key = "#{$1},#{$2}"
|
|
317
312
|
fs[key] ||= Mash.new
|
|
@@ -346,8 +341,7 @@ Ohai.plugin(:Filesystem) do
|
|
|
346
341
|
# this is to allow machines with large amounts of attached LUNs
|
|
347
342
|
# to respond back to the command successfully
|
|
348
343
|
run_with_check(cmdtype) do
|
|
349
|
-
|
|
350
|
-
so.stdout.each_line do |line|
|
|
344
|
+
shell_out(cmd, timeout: 60).stdout.each_line do |line|
|
|
351
345
|
parsed = parse_line(line, cmdtype)
|
|
352
346
|
next if parsed.nil?
|
|
353
347
|
|
|
@@ -383,7 +377,6 @@ Ohai.plugin(:Filesystem) do
|
|
|
383
377
|
# we have to non-block read dev files. Ew.
|
|
384
378
|
f = File.open("/proc/mounts")
|
|
385
379
|
loop do
|
|
386
|
-
|
|
387
380
|
data = f.read_nonblock(4096)
|
|
388
381
|
mounts << data
|
|
389
382
|
# We should just catch EOFError, but the kernel had a period of
|
|
@@ -392,9 +385,9 @@ Ohai.plugin(:Filesystem) do
|
|
|
392
385
|
# whatever data we might have
|
|
393
386
|
rescue Exception
|
|
394
387
|
break
|
|
395
|
-
|
|
396
388
|
end
|
|
397
389
|
f.close
|
|
390
|
+
|
|
398
391
|
mounts.each_line do |line|
|
|
399
392
|
if line =~ /^(\S+) (\S+) (\S+) (\S+) \S+ \S+$/
|
|
400
393
|
key = "#{$1},#{$2}"
|
|
@@ -718,7 +711,8 @@ Ohai.plugin(:Filesystem) do
|
|
|
718
711
|
end
|
|
719
712
|
|
|
720
713
|
collect_data(:windows) do
|
|
721
|
-
require "
|
|
714
|
+
require "set" unless defined?(Set)
|
|
715
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
722
716
|
require_relative "../mash"
|
|
723
717
|
|
|
724
718
|
fs = merge_info(logical_info, encryptable_info)
|
data/lib/ohai/plugins/fips.rb
CHANGED
|
@@ -29,10 +29,6 @@ Ohai.plugin(:Fips) do
|
|
|
29
29
|
fips Mash.new
|
|
30
30
|
|
|
31
31
|
require "openssl" unless defined?(OpenSSL)
|
|
32
|
-
|
|
33
|
-
fips["kernel"] = { "enabled" => true }
|
|
34
|
-
else
|
|
35
|
-
fips["kernel"] = { "enabled" => false }
|
|
36
|
-
end
|
|
32
|
+
fips["kernel"] = { "enabled" => OpenSSL::OPENSSL_FIPS }
|
|
37
33
|
end
|
|
38
34
|
end
|
|
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
|
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
|
21
21
|
|
|
22
22
|
collect_data(:freebsd) do
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
so = shell_out("uname -r")
|
|
26
|
-
platform_version so.stdout.split($/)[0]
|
|
23
|
+
platform shell_out("uname -s").stdout.split($/)[0].downcase
|
|
24
|
+
platform_version shell_out("uname -r").stdout.split($/)[0]
|
|
27
25
|
platform_family "freebsd"
|
|
28
26
|
end
|
|
29
27
|
end
|
data/lib/ohai/plugins/gce.rb
CHANGED
|
@@ -49,7 +49,7 @@ Ohai.plugin(:GCE) do
|
|
|
49
49
|
# @return [Boolean] Are the manufacturer and model Google?
|
|
50
50
|
def has_gce_system_info?
|
|
51
51
|
if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
|
52
|
-
require "wmi-lite/wmi"
|
|
52
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
53
53
|
wmi = WmiLite::Wmi.new
|
|
54
54
|
computer_system = wmi.first_of("Win32_ComputerSystem")
|
|
55
55
|
if computer_system["Manufacturer"] =~ /^Google/ && computer_system["Model"] =~ /^Google/
|
|
@@ -26,9 +26,6 @@
|
|
|
26
26
|
#
|
|
27
27
|
|
|
28
28
|
Ohai.plugin(:Hostname) do
|
|
29
|
-
require "socket" unless defined?(Socket)
|
|
30
|
-
require "ipaddr"
|
|
31
|
-
|
|
32
29
|
provides "domain", "hostname", "fqdn", "machinename"
|
|
33
30
|
|
|
34
31
|
# hostname : short hostname
|
|
@@ -47,6 +44,9 @@ Ohai.plugin(:Hostname) do
|
|
|
47
44
|
# forward and reverse lookup to canonicalize FQDN (hostname -f equivalent)
|
|
48
45
|
# this is ipv6-safe, works on ruby 1.8.7+
|
|
49
46
|
def resolve_fqdn
|
|
47
|
+
require "socket" unless defined?(Socket)
|
|
48
|
+
require "ipaddr" unless defined?(IPAddr)
|
|
49
|
+
|
|
50
50
|
hostname = from_cmd("hostname")
|
|
51
51
|
addrinfo = Socket.getaddrinfo(hostname, nil).first
|
|
52
52
|
iaddr = IPAddr.new(addrinfo[3])
|
|
@@ -161,7 +161,7 @@ Ohai.plugin(:Hostname) do
|
|
|
161
161
|
end
|
|
162
162
|
|
|
163
163
|
collect_data(:windows) do
|
|
164
|
-
require "wmi-lite/wmi"
|
|
164
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
165
165
|
require "socket" unless defined?(Socket)
|
|
166
166
|
|
|
167
167
|
wmi = WmiLite::Wmi.new
|
data/lib/ohai/plugins/kernel.rb
CHANGED
|
@@ -24,8 +24,7 @@ Ohai.plugin(:Hostnamectl) do
|
|
|
24
24
|
|
|
25
25
|
hostnamectl_path = which("hostnamectl")
|
|
26
26
|
if hostnamectl_path
|
|
27
|
-
|
|
28
|
-
hostnamectl_cmd.stdout.split("\n").each do |line|
|
|
27
|
+
shell_out(hostnamectl_path).stdout.split("\n").each do |line|
|
|
29
28
|
key, val = line.split(":")
|
|
30
29
|
hostnamectl[key.chomp.lstrip.tr(" ", "_").downcase] = val.chomp.lstrip
|
|
31
30
|
end
|
|
@@ -24,8 +24,7 @@ Ohai.plugin(:LSB) do
|
|
|
24
24
|
|
|
25
25
|
if File.exist?("/usr/bin/lsb_release")
|
|
26
26
|
# From package redhat-lsb on Fedora/Redhat, lsb-release on Debian/Ubuntu
|
|
27
|
-
|
|
28
|
-
so.stdout.lines do |line|
|
|
27
|
+
shell_out("lsb_release -a").stdout.lines do |line|
|
|
29
28
|
case line
|
|
30
29
|
when /^Distributor ID:\s+(.+)$/
|
|
31
30
|
lsb[:id] = $1
|
|
@@ -24,7 +24,6 @@ Ohai.plugin(:Lspci) do
|
|
|
24
24
|
|
|
25
25
|
collect_data(:linux) do
|
|
26
26
|
devices = Mash.new
|
|
27
|
-
lspci = shell_out("lspci -vnnmk")
|
|
28
27
|
|
|
29
28
|
h = /[0-9a-fA-F]/ # any hex digit
|
|
30
29
|
hh = /#{h}#{h}/ # any 2 hex digits
|
|
@@ -46,7 +45,7 @@ Ohai.plugin(:Lspci) do
|
|
|
46
45
|
end
|
|
47
46
|
end
|
|
48
47
|
|
|
49
|
-
lspci.stdout.split("\n").each do |line|
|
|
48
|
+
shell_out("lspci -vnnmk").stdout.split("\n").each do |line|
|
|
50
49
|
dev = line.scan(/^(.*):\s(.*)$/)[0]
|
|
51
50
|
next if dev.nil?
|
|
52
51
|
|
|
@@ -20,12 +20,12 @@ Ohai.plugin(:Machineid) do
|
|
|
20
20
|
provides "machine_id"
|
|
21
21
|
|
|
22
22
|
collect_data(:linux) do
|
|
23
|
-
mid = nil
|
|
24
|
-
|
|
25
23
|
if ::File.exist?("/etc/machine-id")
|
|
26
24
|
mid = ::File.read("/etc/machine-id").chomp
|
|
27
25
|
elsif ::File.exist?("/var/lib/dbus/machine-id")
|
|
28
26
|
mid = ::File.read("/var/lib/dbus/machine-id").chomp
|
|
27
|
+
else
|
|
28
|
+
mid = nil
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
if mid
|
|
@@ -478,7 +478,7 @@ Ohai.plugin(:Network) do
|
|
|
478
478
|
|
|
479
479
|
# returns the macaddress for interface from a hash of interfaces (iface elsewhere in this file)
|
|
480
480
|
def get_mac_for_interface(interfaces, interface)
|
|
481
|
-
interfaces[interface][:addresses].
|
|
481
|
+
interfaces[interface][:addresses].find { |k, v| v["family"] == "lladdr" }.first unless interfaces[interface][:addresses].nil? || interfaces[interface][:flags].include?("NOARP")
|
|
482
482
|
end
|
|
483
483
|
|
|
484
484
|
# returns the default route with the lowest metric (unspecified metric is 0)
|
|
@@ -516,8 +516,16 @@ Ohai.plugin(:Network) do
|
|
|
516
516
|
# if the route destination is a default route, it's good
|
|
517
517
|
return true if route[:destination] == "default"
|
|
518
518
|
|
|
519
|
+
return false if default_route[:via].nil?
|
|
520
|
+
|
|
521
|
+
dest_ipaddr = IPAddr.new(route[:destination])
|
|
522
|
+
default_route_via = IPAddr.new(default_route[:via])
|
|
523
|
+
|
|
524
|
+
# check if nexthop is the same address family
|
|
525
|
+
return false if dest_ipaddr.ipv4? != default_route_via.ipv4?
|
|
526
|
+
|
|
519
527
|
# the default route has a gateway and the route matches the gateway
|
|
520
|
-
|
|
528
|
+
dest_ipaddr.include?(default_route_via)
|
|
521
529
|
end
|
|
522
530
|
|
|
523
531
|
# ipv4/ipv6 routes are different enough that having a single algorithm to select the favored route for both creates unnecessary complexity
|
|
@@ -569,7 +577,7 @@ Ohai.plugin(:Network) do
|
|
|
569
577
|
# If the 'ip' binary is available, this plugin may set {ip,mac,ip6}address. The network plugin should not overwrite these.
|
|
570
578
|
# The older code section below that relies on the deprecated net-tools, e.g. netstat and ifconfig, provides less functionality.
|
|
571
579
|
collect_data(:linux) do
|
|
572
|
-
require "ipaddr"
|
|
580
|
+
require "ipaddr" unless defined?(IPAddr)
|
|
573
581
|
|
|
574
582
|
iface = Mash.new
|
|
575
583
|
net_counters = Mash.new
|
|
@@ -20,21 +20,6 @@ Ohai.plugin(:Platform) do
|
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
|
21
21
|
depends "lsb"
|
|
22
22
|
|
|
23
|
-
# the platform mappings between the 'ID' field in /etc/os-release and the value
|
|
24
|
-
# ohai uses. If you're adding a new platform here and you want to change the name
|
|
25
|
-
# you'll want to add it here and then add a spec for the platform_id_remap method
|
|
26
|
-
PLATFORM_MAPPINGS ||= {
|
|
27
|
-
"rhel" => "redhat",
|
|
28
|
-
"amzn" => "amazon",
|
|
29
|
-
"ol" => "oracle",
|
|
30
|
-
"sles" => "suse",
|
|
31
|
-
"sles_sap" => "suse",
|
|
32
|
-
"opensuse-leap" => "opensuseleap",
|
|
33
|
-
"xenenterprise" => "xenserver",
|
|
34
|
-
"cumulus-linux" => "cumulus",
|
|
35
|
-
"archarm" => "arch",
|
|
36
|
-
}.freeze
|
|
37
|
-
|
|
38
23
|
# @deprecated
|
|
39
24
|
def get_redhatish_platform(contents)
|
|
40
25
|
contents[/^Red Hat/i] ? "redhat" : contents[/(\w+)/i, 1].downcase
|
|
@@ -122,8 +107,20 @@ Ohai.plugin(:Platform) do
|
|
|
122
107
|
# this catches the centos guest shell in the nexus switch which identifies itself as centos
|
|
123
108
|
return "nexus_centos" if id == "centos" && os_release_file_is_cisco?
|
|
124
109
|
|
|
125
|
-
#
|
|
126
|
-
|
|
110
|
+
# the platform mappings between the 'ID' field in /etc/os-release and the value
|
|
111
|
+
# ohai uses. If you're adding a new platform here and you want to change the name
|
|
112
|
+
# you'll want to add it here and then add a spec for the platform_id_remap method
|
|
113
|
+
{
|
|
114
|
+
"rhel" => "redhat",
|
|
115
|
+
"amzn" => "amazon",
|
|
116
|
+
"ol" => "oracle",
|
|
117
|
+
"sles" => "suse",
|
|
118
|
+
"sles_sap" => "suse",
|
|
119
|
+
"opensuse-leap" => "opensuseleap",
|
|
120
|
+
"xenenterprise" => "xenserver",
|
|
121
|
+
"cumulus-linux" => "cumulus",
|
|
122
|
+
"archarm" => "arch",
|
|
123
|
+
}[id] || id
|
|
127
124
|
end
|
|
128
125
|
|
|
129
126
|
#
|
|
@@ -26,8 +26,7 @@ Ohai.plugin(:Network) do
|
|
|
26
26
|
counters Mash.new unless counters
|
|
27
27
|
counters[:network] ||= Mash.new
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
so.stdout.lines do |line|
|
|
29
|
+
shell_out("route -n get default").stdout.lines do |line|
|
|
31
30
|
if line =~ /(\w+): ([\w\.]+)/
|
|
32
31
|
case $1
|
|
33
32
|
when "gateway"
|
|
@@ -39,9 +38,8 @@ Ohai.plugin(:Network) do
|
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
iface = Mash.new
|
|
42
|
-
so = shell_out("#{Ohai.abs_path( "/sbin/ifconfig" )} -a")
|
|
43
41
|
cint = nil
|
|
44
|
-
|
|
42
|
+
shell_out("#{Ohai.abs_path( "/sbin/ifconfig" )} -a").stdout.lines do |line|
|
|
45
43
|
if line =~ /^([0-9a-zA-Z\.]+):\s+/
|
|
46
44
|
cint = $1
|
|
47
45
|
iface[cint] = Mash.new
|
|
@@ -85,8 +83,7 @@ Ohai.plugin(:Network) do
|
|
|
85
83
|
end
|
|
86
84
|
end
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
so.stdout.lines do |line|
|
|
86
|
+
shell_out("arp -an").stdout.lines do |line|
|
|
90
87
|
if line =~ /\((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) at ([a-fA-F0-9\:]+) on ([0-9a-zA-Z\.\:\-]+)/
|
|
91
88
|
next unless iface[$3] # this should never happen
|
|
92
89
|
|
|
@@ -102,8 +99,7 @@ Ohai.plugin(:Network) do
|
|
|
102
99
|
# Show the state of all network interfaces or a single interface
|
|
103
100
|
# which have been auto-configured (interfaces statically configured
|
|
104
101
|
# into a system, but not located at boot time are not shown).
|
|
105
|
-
|
|
106
|
-
so.stdout.lines do |line|
|
|
102
|
+
shell_out("netstat -idn").stdout.lines do |line|
|
|
107
103
|
# Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll Drop
|
|
108
104
|
# em0 1500 <Link> 00:11:25:2d:90:be 3719557 0 3369969 0 0 0
|
|
109
105
|
# $1 $2 $3 $4 $5 $6 $7 $8
|
|
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
|
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
|
21
21
|
|
|
22
22
|
collect_data(:netbsd) do
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
so = shell_out("uname -r")
|
|
26
|
-
platform_version so.stdout.split($/)[0]
|
|
23
|
+
platform shell_out("uname -s").stdout.split($/)[0].downcase
|
|
24
|
+
platform_version shell_out("uname -r").stdout.split($/)[0]
|
|
27
25
|
platform_family "netbsd"
|
|
28
26
|
end
|
|
29
27
|
end
|
data/lib/ohai/plugins/network.rb
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#
|
|
18
18
|
|
|
19
19
|
Ohai.plugin(:NetworkAddresses) do
|
|
20
|
-
require "ipaddress"
|
|
21
20
|
require_relative "../mixin/network_helper"
|
|
22
21
|
include Ohai::Mixin::NetworkHelper
|
|
23
22
|
|
|
@@ -88,9 +87,9 @@ Ohai.plugin(:NetworkAddresses) do
|
|
|
88
87
|
r = gw_if_ips.first
|
|
89
88
|
else
|
|
90
89
|
# checking network masks
|
|
91
|
-
r = gw_if_ips.
|
|
90
|
+
r = gw_if_ips.find do |v|
|
|
92
91
|
network_contains_address(network[gw_attr], v[:ipaddress], v[:iface])
|
|
93
|
-
end
|
|
92
|
+
end
|
|
94
93
|
if r.nil?
|
|
95
94
|
r = gw_if_ips.first
|
|
96
95
|
logger.trace("Plugin Network: [#{family}] no ipaddress/mask on #{network[int_attr]} matching the gateway #{network[gw_attr]}, picking #{r[:ipaddress]}")
|
|
@@ -134,6 +133,8 @@ Ohai.plugin(:NetworkAddresses) do
|
|
|
134
133
|
# time as ipaddress. if ipaddress is set and macaddress is nil, that means
|
|
135
134
|
# the interface ipaddress is bound to has the NOARP flag
|
|
136
135
|
collect_data do
|
|
136
|
+
require "ipaddress" unless defined?(IPAddress)
|
|
137
|
+
|
|
137
138
|
results = {}
|
|
138
139
|
|
|
139
140
|
network Mash.new unless network
|
|
@@ -26,8 +26,7 @@ Ohai.plugin(:Network) do
|
|
|
26
26
|
counters Mash.new unless counters
|
|
27
27
|
counters[:network] ||= Mash.new
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
so.stdout.lines do |line|
|
|
29
|
+
shell_out("route -n get default").stdout.lines do |line|
|
|
31
30
|
if line =~ /(\w+): ([\w\.]+)/
|
|
32
31
|
case $1
|
|
33
32
|
when "gateway"
|
|
@@ -39,9 +38,8 @@ Ohai.plugin(:Network) do
|
|
|
39
38
|
end
|
|
40
39
|
|
|
41
40
|
iface = Mash.new
|
|
42
|
-
so = shell_out( "#{Ohai.abs_path( "/sbin/ifconfig" )} -a" )
|
|
43
41
|
cint = nil
|
|
44
|
-
|
|
42
|
+
shell_out( "#{Ohai.abs_path( "/sbin/ifconfig" )} -a" ).stdout.lines do |line|
|
|
45
43
|
if line =~ /^([0-9a-zA-Z\.]+):\s+/
|
|
46
44
|
cint = $1
|
|
47
45
|
iface[cint] = Mash.new
|
|
@@ -85,8 +83,7 @@ Ohai.plugin(:Network) do
|
|
|
85
83
|
end
|
|
86
84
|
end
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
so.stdout.lines do |line|
|
|
86
|
+
shell_out("arp -an").stdout.lines do |line|
|
|
90
87
|
if line =~ /\((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) at ([a-fA-F0-9\:]+) on ([0-9a-zA-Z\.\:\-]+)/
|
|
91
88
|
next unless iface[$3] # this should never happen
|
|
92
89
|
|
|
@@ -102,8 +99,7 @@ Ohai.plugin(:Network) do
|
|
|
102
99
|
# Show the state of all network interfaces or a single interface
|
|
103
100
|
# which have been auto-configured (interfaces statically configured
|
|
104
101
|
# into a system, but not located at boot time are not shown).
|
|
105
|
-
|
|
106
|
-
so.stdout.lines do |line|
|
|
102
|
+
shell_out("netstat -idn").stdout.lines do |line|
|
|
107
103
|
# Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll Drop
|
|
108
104
|
# em0 1500 <Link> 00:11:25:2d:90:be 3719557 0 3369969 0 0 0
|
|
109
105
|
# $1 $2 $3 $4 $5 $6 $7 $8
|
|
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
|
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
|
21
21
|
|
|
22
22
|
collect_data(:openbsd) do
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
so = shell_out("uname -r")
|
|
26
|
-
platform_version so.stdout.split($/)[0]
|
|
23
|
+
platform shell_out("uname -s").stdout.split($/)[0].downcase
|
|
24
|
+
platform_version shell_out("uname -r").stdout.split($/)[0]
|
|
27
25
|
platform_family "openbsd"
|
|
28
26
|
end
|
|
29
27
|
end
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
Ohai.plugin(:Openstack) do
|
|
20
20
|
require_relative "../mixin/ec2_metadata"
|
|
21
21
|
require_relative "../mixin/http_helper"
|
|
22
|
-
require "etc" unless defined?(Etc)
|
|
23
22
|
include Ohai::Mixin::Ec2Metadata
|
|
24
23
|
include Ohai::Mixin::HttpHelper
|
|
25
24
|
|
|
@@ -59,6 +58,8 @@ Ohai.plugin(:Openstack) do
|
|
|
59
58
|
end
|
|
60
59
|
|
|
61
60
|
collect_data do
|
|
61
|
+
require "etc" unless defined?(Etc)
|
|
62
|
+
|
|
62
63
|
# fetch data if we look like openstack
|
|
63
64
|
if openstack_hint? || openstack_virtualization?
|
|
64
65
|
openstack Mash.new
|
data/lib/ohai/plugins/passwd.rb
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
Ohai.plugin(:Passwd) do
|
|
3
|
-
require "etc" unless defined?(Etc)
|
|
4
3
|
provides "etc", "current_user"
|
|
5
4
|
optional true
|
|
6
5
|
|
|
@@ -14,6 +13,8 @@ Ohai.plugin(:Passwd) do
|
|
|
14
13
|
end
|
|
15
14
|
|
|
16
15
|
collect_data do
|
|
16
|
+
require "etc" unless defined?(Etc)
|
|
17
|
+
|
|
17
18
|
unless etc
|
|
18
19
|
etc Mash.new
|
|
19
20
|
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
|
|
17
17
|
Ohai.plugin(:Rackspace) do
|
|
18
|
-
require "resolv"
|
|
19
18
|
provides "rackspace"
|
|
20
19
|
|
|
21
20
|
depends "kernel", "network/interfaces"
|
|
@@ -50,7 +49,7 @@ Ohai.plugin(:Rackspace) do
|
|
|
50
49
|
def has_rackspace_manufacturer?
|
|
51
50
|
return false unless RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
|
52
51
|
|
|
53
|
-
require "wmi-lite/wmi"
|
|
52
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
54
53
|
wmi = WmiLite::Wmi.new
|
|
55
54
|
if wmi.first_of("Win32_ComputerSystem")["PrimaryOwnerName"] == "Rackspace"
|
|
56
55
|
logger.trace("Plugin Rackspace: has_rackspace_manufacturer? == true")
|
|
@@ -147,6 +146,8 @@ Ohai.plugin(:Rackspace) do
|
|
|
147
146
|
end
|
|
148
147
|
|
|
149
148
|
collect_data do
|
|
149
|
+
require "resolv"
|
|
150
|
+
|
|
150
151
|
# Adds rackspace Mash
|
|
151
152
|
if looks_like_rackspace?
|
|
152
153
|
rackspace Mash.new
|
|
@@ -19,7 +19,7 @@ Ohai.plugin(:RootGroup) do
|
|
|
19
19
|
provides "root_group"
|
|
20
20
|
|
|
21
21
|
collect_data(:windows) do
|
|
22
|
-
require "wmi-lite/wmi"
|
|
22
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
23
23
|
|
|
24
24
|
wmi = WmiLite::Wmi.new
|
|
25
25
|
# Per http://support.microsoft.com/kb/243330 SID: S-1-5-32-544 is the
|
data/lib/ohai/plugins/ruby.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -43,6 +43,8 @@ Ohai.plugin(:Ruby) do
|
|
|
43
43
|
host_vendor: "RbConfig::CONFIG['host_vendor']",
|
|
44
44
|
bin_dir: "RbConfig::CONFIG['bindir']",
|
|
45
45
|
ruby_bin: "::File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])",
|
|
46
|
+
gem_bin: "::File.join(RbConfig::CONFIG['bindir'], ::Gem.default_exec_format % 'gem')",
|
|
47
|
+
gems_dir: "::Gem.dir",
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
# Create a query string from above hash
|
|
@@ -52,25 +54,12 @@ Ohai.plugin(:Ruby) do
|
|
|
52
54
|
end
|
|
53
55
|
|
|
54
56
|
# Query the system ruby
|
|
55
|
-
result = run_ruby "puts %Q(#{env_string})"
|
|
57
|
+
result = run_ruby "require 'rubygems'; puts %Q(#{env_string})"
|
|
56
58
|
|
|
57
59
|
# Parse results to plugin hash
|
|
58
60
|
result.split(",").each do |entry|
|
|
59
61
|
key, value = entry.split("=")
|
|
60
62
|
languages[:ruby][key.to_sym] = value || ""
|
|
61
63
|
end
|
|
62
|
-
|
|
63
|
-
# Perform one more (conditional) query
|
|
64
|
-
bin_dir = languages[:ruby][:bin_dir]
|
|
65
|
-
ruby_bin = languages[:ruby][:ruby_bin]
|
|
66
|
-
gem_binaries = [
|
|
67
|
-
run_ruby("require 'rubygems'; puts ::Gem.default_exec_format % 'gem'"),
|
|
68
|
-
"gem",
|
|
69
|
-
].map { |bin| ::File.join(bin_dir, bin) }
|
|
70
|
-
gem_binary = gem_binaries.find { |bin| ::File.exist? bin }
|
|
71
|
-
if gem_binary
|
|
72
|
-
languages[:ruby][:gems_dir] = run_ruby "puts %x{#{ruby_bin} #{gem_binary} env gemdir}.chomp!"
|
|
73
|
-
languages[:ruby][:gem_bin] = gem_binary
|
|
74
|
-
end
|
|
75
64
|
end
|
|
76
65
|
end
|
|
@@ -26,7 +26,7 @@ Ohai.plugin(:Scaleway) do
|
|
|
26
26
|
# looks for `scaleway` keyword in kernel command line
|
|
27
27
|
# @return [Boolean] do we have the keyword or not?
|
|
28
28
|
def has_scaleway_cmdline?
|
|
29
|
-
if ::File.
|
|
29
|
+
if ::File.exist?("/proc/cmdline") && /scaleway/.match?(::File.read("/proc/cmdline"))
|
|
30
30
|
logger.trace("Plugin Scaleway: has_scaleway_cmdline? == true")
|
|
31
31
|
return true
|
|
32
32
|
end
|
data/lib/ohai/plugins/shard.rb
CHANGED
|
@@ -86,7 +86,7 @@ Ohai.plugin(:DMI) do
|
|
|
86
86
|
"SUN_OEM_EXT_MEMARRAY" => 144, # phys memory array extended info
|
|
87
87
|
"SUN_OEM_EXT_MEMDEVICE" => 145, # memory device extended info
|
|
88
88
|
"SMB_TYPE_OEM_HI" => 256, # end of OEM-specific type range
|
|
89
|
-
}
|
|
89
|
+
}.freeze
|
|
90
90
|
|
|
91
91
|
# all output lines should fall within one of these patterns
|
|
92
92
|
header_type_line = /^ID\s+SIZE\s+TYPE/
|
|
@@ -99,7 +99,6 @@ Ohai.plugin(:DMI) do
|
|
|
99
99
|
dmi_record = nil
|
|
100
100
|
field = nil
|
|
101
101
|
|
|
102
|
-
so = shell_out("smbios")
|
|
103
102
|
# ==== EXAMPLE: ====
|
|
104
103
|
# ID SIZE TYPE
|
|
105
104
|
# 0 40 SMB_TYPE_BIOS (BIOS information)
|
|
@@ -111,7 +110,7 @@ Ohai.plugin(:DMI) do
|
|
|
111
110
|
# SMB_BIOSFL_PCI (PCI is supported)
|
|
112
111
|
# ... similar lines trimmed
|
|
113
112
|
# note the second level of indentation is via a *tab*
|
|
114
|
-
|
|
113
|
+
shell_out("smbios").stdout.lines do |raw_line|
|
|
115
114
|
next if header_type_line.match(raw_line)
|
|
116
115
|
next if blank_line.match(raw_line)
|
|
117
116
|
|
|
@@ -20,8 +20,7 @@ Ohai.plugin(:Memory) do
|
|
|
20
20
|
collect_data(:solaris2) do
|
|
21
21
|
memory Mash.new
|
|
22
22
|
memory[:swap] = Mash.new
|
|
23
|
-
|
|
24
|
-
memory[:total] = "#{meminfo.split[2].to_i * 1024}kB"
|
|
23
|
+
memory[:total] = "#{shell_out("prtconf | grep Memory").stdout.split[2].to_i * 1024}kB"
|
|
25
24
|
|
|
26
25
|
tokens = shell_out("swap -s").stdout.strip.split
|
|
27
26
|
used_swap = tokens[8][0..-1].to_i # strip k from end
|
|
@@ -54,13 +54,11 @@
|
|
|
54
54
|
# inet6 fe80::203:baff:fe17:4444/128
|
|
55
55
|
|
|
56
56
|
# Extracted from http://illumos.org/hcl/
|
|
57
|
-
|
|
58
|
-
ETHERNET_ENCAPS = %w{ afe amd8111s arn atge ath bfe bge bnx bnxe ce cxgbe
|
|
57
|
+
ETHERNET_ENCAPS ||= %w{ afe amd8111s arn atge ath bfe bge bnx bnxe ce cxgbe
|
|
59
58
|
dmfe e1000g efe elxl emlxs eri hermon hme hxge igb
|
|
60
59
|
iprb ipw iwh iwi iwk iwp ixgb ixgbe mwl mxfe myri10ge
|
|
61
60
|
nge ntxn nxge pcn platform qfe qlc ral rge rtls rtw rwd
|
|
62
61
|
rwn sfe tavor vr wpi xge yge aggr}.freeze
|
|
63
|
-
end
|
|
64
62
|
|
|
65
63
|
Ohai.plugin(:Network) do
|
|
66
64
|
require_relative "../../mixin/network_helper"
|
|
@@ -102,10 +100,8 @@ Ohai.plugin(:Network) do
|
|
|
102
100
|
counters Mash.new unless counters
|
|
103
101
|
counters[:network] ||= Mash.new
|
|
104
102
|
|
|
105
|
-
so = shell_out("ifconfig -a")
|
|
106
103
|
cint = nil
|
|
107
|
-
|
|
108
|
-
so.stdout.lines do |line|
|
|
104
|
+
shell_out("ifconfig -a").stdout.lines do |line|
|
|
109
105
|
# regex: https://rubular.com/r/ZiIHbsnfiWPW1p
|
|
110
106
|
if line =~ /^([0-9a-zA-Z\.\:\-]+): \S+ mtu (\d+)(?: index (\d+))?/
|
|
111
107
|
cint = $1
|
|
@@ -25,9 +25,7 @@ Ohai.plugin(:Virtualization) do
|
|
|
25
25
|
depends "dmi"
|
|
26
26
|
|
|
27
27
|
def collect_solaris_guestid
|
|
28
|
-
|
|
29
|
-
so = shell_out(command)
|
|
30
|
-
so.stdout.split(":").first
|
|
28
|
+
shell_out("/usr/sbin/zoneadm list -p").stdout.split(":").first
|
|
31
29
|
end
|
|
32
30
|
|
|
33
31
|
collect_data(:solaris2) do
|
|
@@ -56,8 +54,7 @@ Ohai.plugin(:Virtualization) do
|
|
|
56
54
|
|
|
57
55
|
if File.executable?("/usr/sbin/zoneadm")
|
|
58
56
|
zones = Mash.new
|
|
59
|
-
|
|
60
|
-
so.stdout.lines do |line|
|
|
57
|
+
shell_out("zoneadm list -pc").stdout.lines do |line|
|
|
61
58
|
info = line.chomp.split(/:/)
|
|
62
59
|
zones[info[1]] = {
|
|
63
60
|
"id" => info[0],
|
data/lib/ohai/plugins/uptime.rb
CHANGED
|
@@ -84,7 +84,7 @@ Ohai.plugin(:Uptime) do
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
collect_data(:windows) do
|
|
87
|
-
require "wmi-lite/wmi"
|
|
87
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
88
88
|
wmi = WmiLite::Wmi.new
|
|
89
89
|
last_boot_up_time = wmi.first_of("Win32_OperatingSystem")["lastbootuptime"]
|
|
90
90
|
uptime_seconds Time.new.to_i - Time.parse(last_boot_up_time).to_i
|
|
@@ -45,8 +45,8 @@ Ohai.plugin(:DMI) do
|
|
|
45
45
|
].freeze
|
|
46
46
|
|
|
47
47
|
collect_data(:windows) do
|
|
48
|
-
|
|
49
|
-
require "wmi-lite/wmi"
|
|
48
|
+
require_relative "../../common/dmi"
|
|
49
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
50
50
|
wmi = WmiLite::Wmi.new
|
|
51
51
|
|
|
52
52
|
dmi Mash.new
|
|
@@ -24,7 +24,7 @@ Ohai.plugin(:Virtualization) do
|
|
|
24
24
|
include Ohai::Mixin::DmiDecode
|
|
25
25
|
|
|
26
26
|
collect_data(:windows) do
|
|
27
|
-
require "wmi-lite/wmi"
|
|
27
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
|
28
28
|
|
|
29
29
|
virtualization Mash.new unless virtualization
|
|
30
30
|
virtualization[:systems] ||= Mash.new
|
data/lib/ohai/runner.rb
CHANGED
data/lib/ohai/util/ip_helper.rb
CHANGED
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
# See the License for the specific language governing permissions and
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
|
|
17
|
-
require "ipaddress"
|
|
18
|
-
|
|
19
17
|
module Ohai
|
|
20
18
|
module Util
|
|
21
19
|
module IpHelper
|
|
20
|
+
require "ipaddress" unless defined?(IPAddress)
|
|
21
|
+
|
|
22
22
|
# Corresponding to RFC 4192 + RFC 4193
|
|
23
23
|
IPV6_LINK_LOCAL_UNICAST_BLOCK = IPAddress("fe80::/10")
|
|
24
24
|
IPV6_PRIVATE_ADDRESS_BLOCK = IPAddress("fc00::/7")
|
data/lib/ohai/version.rb
CHANGED
data/ohai.gemspec
CHANGED
|
@@ -14,7 +14,6 @@ Gem::Specification.new do |s|
|
|
|
14
14
|
|
|
15
15
|
s.required_ruby_version = ">= 2.5"
|
|
16
16
|
|
|
17
|
-
s.add_dependency "systemu", "~> 2.6.4"
|
|
18
17
|
s.add_dependency "ffi-yajl", "~> 2.2"
|
|
19
18
|
s.add_dependency "mixlib-cli", ">= 1.7.0" # 1.7+ needed to support passing multiple options
|
|
20
19
|
s.add_dependency "mixlib-config", ">= 2.0", "< 4.0"
|
metadata
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ohai
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 16.
|
|
4
|
+
version: 16.4.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Jacob
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-08-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
name: systemu
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - "~>"
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.6.4
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.6.4
|
|
27
13
|
- !ruby/object:Gem::Dependency
|
|
28
14
|
name: ffi-yajl
|
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|