ohai 16.3.2 → 16.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -4
- data/bin/ohai +1 -1
- data/lib/ohai.rb +1 -1
- data/lib/ohai/application.rb +2 -2
- data/lib/ohai/config.rb +2 -3
- data/lib/ohai/dsl.rb +1 -1
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -1
- data/lib/ohai/exception.rb +1 -1
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +2 -3
- data/lib/ohai/log.rb +2 -2
- data/lib/ohai/mixin/azure_metadata.rb +1 -1
- data/lib/ohai/mixin/chef_utils_wiring.rb +39 -0
- data/lib/ohai/mixin/command.rb +3 -54
- data/lib/ohai/mixin/constant_helper.rb +1 -1
- data/lib/ohai/mixin/dmi_decode.rb +1 -1
- data/lib/ohai/mixin/do_metadata.rb +1 -1
- data/lib/ohai/mixin/ec2_metadata.rb +3 -3
- data/lib/ohai/mixin/http_helper.rb +1 -1
- data/lib/ohai/mixin/network_helper.rb +1 -1
- data/lib/ohai/mixin/os.rb +2 -2
- data/lib/ohai/mixin/scaleway_metadata.rb +1 -1
- data/lib/ohai/mixin/seconds_to_human.rb +1 -1
- data/lib/ohai/mixin/shell_out.rb +50 -0
- data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
- data/lib/ohai/mixin/string.rb +1 -1
- data/lib/ohai/mixin/which.rb +38 -0
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/kernel.rb +1 -1
- data/lib/ohai/plugins/aix/memory.rb +3 -3
- data/lib/ohai/plugins/aix/network.rb +3 -2
- data/lib/ohai/plugins/aix/platform.rb +1 -1
- data/lib/ohai/plugins/aix/uptime.rb +2 -2
- data/lib/ohai/plugins/aix/virtualization.rb +1 -1
- data/lib/ohai/plugins/azure.rb +1 -1
- data/lib/ohai/plugins/bsd/virtualization.rb +2 -2
- data/lib/ohai/plugins/cloud.rb +2 -2
- data/lib/ohai/plugins/command.rb +1 -1
- data/lib/ohai/plugins/cpu.rb +3 -3
- data/lib/ohai/plugins/darwin/memory.rb +1 -1
- data/lib/ohai/plugins/darwin/network.rb +1 -1
- data/lib/ohai/plugins/darwin/platform.rb +2 -2
- data/lib/ohai/plugins/darwin/virtualization.rb +1 -1
- data/lib/ohai/plugins/docker.rb +3 -3
- data/lib/ohai/plugins/dragonflybsd/platform.rb +2 -4
- data/lib/ohai/plugins/ec2.rb +4 -3
- data/lib/ohai/plugins/erlang.rb +1 -1
- data/lib/ohai/plugins/eucalyptus.rb +1 -1
- data/lib/ohai/plugins/filesystem.rb +8 -14
- data/lib/ohai/plugins/fips.rb +2 -6
- data/lib/ohai/plugins/freebsd/platform.rb +2 -4
- data/lib/ohai/plugins/gce.rb +1 -1
- data/lib/ohai/plugins/hostname.rb +5 -5
- data/lib/ohai/plugins/init_package.rb +1 -1
- data/lib/ohai/plugins/java.rb +1 -1
- data/lib/ohai/plugins/kernel.rb +3 -3
- data/lib/ohai/plugins/keys.rb +1 -1
- data/lib/ohai/plugins/languages.rb +1 -1
- data/lib/ohai/plugins/libvirt.rb +1 -1
- data/lib/ohai/plugins/linode.rb +1 -1
- data/lib/ohai/plugins/linux/block_device.rb +1 -1
- data/lib/ohai/plugins/linux/hostnamectl.rb +1 -2
- data/lib/ohai/plugins/linux/ipc.rb +1 -1
- data/lib/ohai/plugins/linux/lsb.rb +2 -3
- data/lib/ohai/plugins/linux/lspci.rb +1 -2
- data/lib/ohai/plugins/linux/machineid.rb +2 -2
- data/lib/ohai/plugins/linux/memory.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +21 -13
- data/lib/ohai/plugins/linux/platform.rb +15 -18
- data/lib/ohai/plugins/linux/virtualization.rb +1 -1
- data/lib/ohai/plugins/netbsd/network.rb +4 -8
- data/lib/ohai/plugins/netbsd/platform.rb +2 -4
- data/lib/ohai/plugins/network.rb +5 -4
- data/lib/ohai/plugins/ohai_time.rb +1 -1
- data/lib/ohai/plugins/openbsd/network.rb +4 -8
- data/lib/ohai/plugins/openbsd/platform.rb +2 -4
- data/lib/ohai/plugins/openstack.rb +3 -2
- data/lib/ohai/plugins/os.rb +1 -1
- data/lib/ohai/plugins/packages.rb +21 -1
- data/lib/ohai/plugins/passwd.rb +2 -1
- data/lib/ohai/plugins/perl.rb +1 -1
- data/lib/ohai/plugins/platform.rb +1 -1
- data/lib/ohai/plugins/powershell.rb +1 -1
- data/lib/ohai/plugins/ps.rb +1 -1
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +5 -4
- 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 +2 -2
- data/lib/ohai/plugins/shells.rb +1 -1
- data/lib/ohai/plugins/softlayer.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 +8 -14
- data/lib/ohai/plugins/solaris2/platform.rb +2 -3
- data/lib/ohai/plugins/solaris2/virtualization.rb +3 -6
- data/lib/ohai/plugins/ssh_host_key.rb +1 -1
- data/lib/ohai/plugins/uptime.rb +2 -2
- data/lib/ohai/plugins/virtualbox.rb +1 -1
- data/lib/ohai/plugins/vmware.rb +1 -1
- data/lib/ohai/plugins/windows/dmi.rb +2 -2
- data/lib/ohai/plugins/windows/drivers.rb +2 -2
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +3 -3
- data/lib/ohai/plugins/windows/platform.rb +1 -1
- data/lib/ohai/plugins/windows/system_enclosure.rb +1 -1
- data/lib/ohai/plugins/windows/virtualization.rb +2 -2
- data/lib/ohai/plugins/zpools.rb +1 -1
- data/lib/ohai/provides_map.rb +1 -1
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +2 -3
- data/lib/ohai/util/file_helper.rb +4 -37
- data/lib/ohai/util/ip_helper.rb +2 -2
- data/lib/ohai/util/win32.rb +1 -1
- data/lib/ohai/version.rb +3 -3
- data/ohai.gemspec +5 -7
- metadata +62 -73
data/lib/ohai/plugins/network.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");
|
@@ -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
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matt Ray (<matt@chef.io>)
|
3
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -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/os.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Isa Farnik (<isa@chef.io>)
|
4
4
|
# Author:: Richard Manyanza (<liseki@nyikacraftsmen.com>)
|
5
|
-
# Copyright:: Copyright (c)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
6
|
# Copyright:: Copyright (c) 2014 Richard Manyanza.
|
7
7
|
# License:: Apache License, Version 2.0
|
8
8
|
#
|
@@ -79,7 +79,7 @@ Ohai.plugin(:Packages) do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
when "arch"
|
82
|
-
require "date"
|
82
|
+
require "date" unless defined?(DateTime)
|
83
83
|
|
84
84
|
# Set LANG=C to force an easy to parse date format
|
85
85
|
so = shell_out("LANG=C pacman -Qi")
|
@@ -209,4 +209,24 @@ Ohai.plugin(:Packages) do
|
|
209
209
|
collect_ips_packages
|
210
210
|
collect_sysv_packages
|
211
211
|
end
|
212
|
+
|
213
|
+
def collect_system_profiler_apps
|
214
|
+
require "plist"
|
215
|
+
sp_std = shell_out("system_profiler SPApplicationsDataType -xml")
|
216
|
+
results = Plist.parse_xml(sp_std.stdout)
|
217
|
+
sw_array = results[0]["_items"]
|
218
|
+
sw_array.each do |pkg|
|
219
|
+
packages[pkg["_name"]] = {
|
220
|
+
"version" => pkg["version"],
|
221
|
+
"lastmodified" => pkg["lastModified"],
|
222
|
+
"source" => pkg["obtained_from"],
|
223
|
+
}
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
collect_data(:darwin) do
|
228
|
+
packages Mash.new
|
229
|
+
collect_system_profiler_apps
|
230
|
+
end
|
231
|
+
|
212
232
|
end
|
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
|
|
data/lib/ohai/plugins/perl.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Joshua Timberman (<joshua@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");
|
data/lib/ohai/plugins/ps.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
3
|
# Author:: Bryan McLellan (<btm@loftninjas.org>)
|
4
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
5
|
# Copyright:: Copyright (c) 2009 Bryan McLellan
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
data/lib/ohai/plugins/python.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Thom May (<thom@clearairturbulence.org>)
|
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");
|
@@ -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
|
@@ -160,8 +161,8 @@ Ohai.plugin(:Rackspace) do
|
|
160
161
|
unless rackspace[:public_ip].nil?
|
161
162
|
rackspace[:public_hostname] = begin
|
162
163
|
Resolv.getname(rackspace[:public_ip])
|
163
|
-
|
164
|
-
|
164
|
+
rescue Resolv::ResolvError, Resolv::ResolvTimeout
|
165
|
+
rackspace[:public_ip]
|
165
166
|
end
|
166
167
|
end
|
167
168
|
rackspace[:local_ipv4] = rackspace[:private_ip]
|
@@ -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
@@ -52,7 +52,7 @@ Ohai.plugin(:ShardSeed) do
|
|
52
52
|
def digest_algorithm
|
53
53
|
case Ohai.config[:plugin][:shard_seed][:digest_algorithm] || default_digest_algorithm
|
54
54
|
when "md5"
|
55
|
-
require "digest/md5"
|
55
|
+
require "digest/md5" unless defined?(Digest::MD5)
|
56
56
|
Digest::MD5
|
57
57
|
when "sha256"
|
58
58
|
require "openssl/digest"
|
@@ -94,7 +94,7 @@ Ohai.plugin(:ShardSeed) do
|
|
94
94
|
end
|
95
95
|
|
96
96
|
collect_data(:windows) do
|
97
|
-
require "wmi-lite/wmi"
|
97
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
98
98
|
wmi = WmiLite::Wmi.new
|
99
99
|
|
100
100
|
create_seed do |src|
|
data/lib/ohai/plugins/shells.rb
CHANGED
@@ -39,7 +39,7 @@ Ohai.plugin(:Softlayer) do
|
|
39
39
|
logger.trace("Plugin Softlayer: looks_like_softlayer? == true")
|
40
40
|
metadata = fetch_metadata
|
41
41
|
softlayer Mash.new
|
42
|
-
metadata
|
42
|
+
metadata&.each { |k, v| softlayer[k] = v }
|
43
43
|
else
|
44
44
|
logger.trace("Plugin Softlayer: looks_like_softlayer? == false")
|
45
45
|
end
|
@@ -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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Benjamin Black (<nostromo@gmail.com>)
|
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");
|
@@ -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"
|
@@ -88,7 +86,7 @@ Ohai.plugin(:Network) do
|
|
88
86
|
|
89
87
|
def full_interface_name(iface, part_name, index)
|
90
88
|
iface.each do |name, attrs|
|
91
|
-
next unless attrs
|
89
|
+
next unless attrs.respond_to?(:[])
|
92
90
|
return name if /^#{part_name}($|:)/.match(name) && attrs[:index] == index
|
93
91
|
end
|
94
92
|
|
@@ -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
|
@@ -159,12 +155,10 @@ Ohai.plugin(:Network) do
|
|
159
155
|
break
|
160
156
|
end
|
161
157
|
end
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
break
|
167
|
-
end
|
158
|
+
iface[ifn][:arp]&.each_key do |addr|
|
159
|
+
if addr.eql?(iaddr)
|
160
|
+
iface[ifn][:addresses][iface[ifn][:arp][iaddr]] = { "family" => "lladdr" }
|
161
|
+
break
|
168
162
|
end
|
169
163
|
end
|
170
164
|
end
|