ohai 15.0.35 → 15.1.3
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/lib/ohai.rb +4 -4
- data/lib/ohai/application.rb +3 -3
- data/lib/ohai/config.rb +2 -2
- data/lib/ohai/dsl.rb +2 -2
- data/lib/ohai/dsl/plugin.rb +5 -5
- data/lib/ohai/hints.rb +1 -1
- data/lib/ohai/loader.rb +4 -4
- data/lib/ohai/mixin/azure_metadata.rb +3 -3
- data/lib/ohai/mixin/command.rb +3 -3
- data/lib/ohai/mixin/do_metadata.rb +3 -3
- data/lib/ohai/mixin/ec2_metadata.rb +6 -6
- data/lib/ohai/mixin/gce_metadata.rb +3 -3
- data/lib/ohai/mixin/http_helper.rb +1 -1
- data/lib/ohai/mixin/scaleway_metadata.rb +3 -3
- data/lib/ohai/mixin/softlayer_metadata.rb +2 -2
- data/lib/ohai/plugin_config.rb +1 -1
- data/lib/ohai/plugins/aix/network.rb +6 -6
- data/lib/ohai/plugins/azure.rb +2 -2
- data/lib/ohai/plugins/bsd/virtualization.rb +2 -2
- data/lib/ohai/plugins/darwin/network.rb +14 -13
- data/lib/ohai/plugins/darwin/virtualization.rb +1 -1
- data/lib/ohai/plugins/digital_ocean.rb +2 -2
- data/lib/ohai/plugins/dmi.rb +3 -3
- data/lib/ohai/plugins/dragonflybsd/network.rb +9 -9
- data/lib/ohai/plugins/ec2.rb +2 -2
- data/lib/ohai/plugins/eucalyptus.rb +2 -2
- data/lib/ohai/plugins/filesystem.rb +5 -5
- data/lib/ohai/plugins/freebsd/network.rb +9 -9
- data/lib/ohai/plugins/gce.rb +2 -2
- data/lib/ohai/plugins/hostname.rb +2 -2
- data/lib/ohai/plugins/kernel.rb +1 -1
- data/lib/ohai/plugins/linux/fips.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +18 -18
- data/lib/ohai/plugins/linux/platform.rb +1 -3
- data/lib/ohai/plugins/linux/sessions.rb +2 -2
- data/lib/ohai/plugins/linux/virtualization.rb +2 -2
- data/lib/ohai/plugins/netbsd/network.rb +9 -9
- data/lib/ohai/plugins/network.rb +3 -3
- data/lib/ohai/plugins/openbsd/network.rb +9 -9
- data/lib/ohai/plugins/openstack.rb +2 -2
- data/lib/ohai/plugins/os.rb +1 -1
- data/lib/ohai/plugins/packages.rb +6 -8
- data/lib/ohai/plugins/passwd.rb +1 -1
- data/lib/ohai/plugins/scaleway.rb +2 -2
- data/lib/ohai/plugins/scsi.rb +1 -1
- data/lib/ohai/plugins/softlayer.rb +1 -1
- data/lib/ohai/plugins/solaris2/dmi.rb +2 -2
- data/lib/ohai/plugins/solaris2/network.rb +9 -9
- data/lib/ohai/plugins/solaris2/virtualization.rb +1 -1
- data/lib/ohai/plugins/uptime.rb +1 -1
- data/lib/ohai/plugins/virtualbox.rb +164 -19
- data/lib/ohai/plugins/windows/filesystem.rb +1 -1
- data/lib/ohai/plugins/windows/fips.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +3 -3
- data/lib/ohai/plugins/windows/virtualization.rb +2 -2
- data/lib/ohai/provides_map.rb +4 -4
- data/lib/ohai/runner.rb +1 -1
- data/lib/ohai/system.rb +15 -15
- data/lib/ohai/util/win32.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +10 -1
- data/spec/unit/plugins/vbox_host_spec.rb +14 -0
- data/spec/unit/plugins/virtualbox_spec.rb +310 -23
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7c38d18ba317c18ecba9a443a7e56bd45b6ae8eb546694588954699ef74f5e8
|
4
|
+
data.tar.gz: 6708362273b4e202c3b6dc59e65490618b72ad6b79eaab1065e85a0c5b3cc4e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad8dc68e5fae6d069e227f5678a3e0e2d78cb098a17de6cdff595feeb24515e3c3fe86d1c63ea1a583a334350d3b6fd123fda0dfb63c1f4c37ac5117375aabb1
|
7
|
+
data.tar.gz: 463c53e37b1a8bdc6a0f9606c7316109ee8fbf72049f39c7dbac7fae93f584b7ede41174e4e619ac2a8a1ebc70e78515b156f8ba77f5795365e5fd57707cfe32
|
data/lib/ohai.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
require_relative "ohai/version"
|
20
|
+
require_relative "ohai/config"
|
21
|
+
require_relative "ohai/system"
|
22
|
+
require_relative "ohai/exception"
|
data/lib/ohai/application.rb
CHANGED
@@ -17,9 +17,9 @@
|
|
17
17
|
|
18
18
|
require "chef-config/path_helper"
|
19
19
|
require "chef-config/workstation_config_loader"
|
20
|
-
|
21
|
-
|
22
|
-
require "mixlib/cli"
|
20
|
+
require_relative "../ohai"
|
21
|
+
require_relative "log"
|
22
|
+
require "mixlib/cli" unless defined?(Mixlib::CLI)
|
23
23
|
require "benchmark"
|
24
24
|
|
25
25
|
# The Application class is what is called by the Ohai CLI binary. It handles:
|
data/lib/ohai/config.rb
CHANGED
data/lib/ohai/dsl.rb
CHANGED
data/lib/ohai/dsl/plugin.rb
CHANGED
@@ -18,11 +18,11 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
require_relative "../mixin/os"
|
22
|
+
require_relative "../mixin/command"
|
23
|
+
require_relative "../mixin/seconds_to_human"
|
24
|
+
require_relative "../hints"
|
25
|
+
require_relative "../util/file_helper"
|
26
26
|
|
27
27
|
module Ohai
|
28
28
|
|
data/lib/ohai/hints.rb
CHANGED
data/lib/ohai/loader.rb
CHANGED
@@ -17,10 +17,10 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "chef-config/path_helper"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
require "pathname"
|
20
|
+
require_relative "log"
|
21
|
+
require_relative "mash"
|
22
|
+
require_relative "dsl"
|
23
|
+
require "pathname" unless defined?(Pathname)
|
24
24
|
|
25
25
|
module Ohai
|
26
26
|
|
@@ -15,14 +15,14 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
-
require "net/http"
|
18
|
+
require "net/http" unless defined?(Net::HTTP)
|
19
19
|
|
20
20
|
module Ohai
|
21
21
|
module Mixin
|
22
22
|
module AzureMetadata
|
23
23
|
|
24
|
-
AZURE_METADATA_ADDR
|
25
|
-
AZURE_METADATA_URL
|
24
|
+
AZURE_METADATA_ADDR ||= "169.254.169.254".freeze
|
25
|
+
AZURE_METADATA_URL ||= "/metadata/instance?api-version=2017-08-01".freeze
|
26
26
|
|
27
27
|
# fetch the meta content with a timeout and the required header
|
28
28
|
def http_get(uri)
|
data/lib/ohai/mixin/command.rb
CHANGED
@@ -17,9 +17,9 @@
|
|
17
17
|
# limitations under the License.
|
18
18
|
#
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
require "mixlib/shellout"
|
20
|
+
require_relative "../exception"
|
21
|
+
require_relative "../log"
|
22
|
+
require "mixlib/shellout" unless defined?(Mixlib::ShellOut::DEFAULT_READ_TIMEOUT)
|
23
23
|
|
24
24
|
module Ohai
|
25
25
|
module Mixin
|
@@ -14,14 +14,14 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
-
require "net/http"
|
17
|
+
require "net/http" unless defined?(Net::HTTP)
|
18
18
|
|
19
19
|
module Ohai
|
20
20
|
module Mixin
|
21
21
|
module DOMetadata
|
22
22
|
|
23
|
-
DO_METADATA_ADDR
|
24
|
-
DO_METADATA_URL
|
23
|
+
DO_METADATA_ADDR ||= "169.254.169.254".freeze
|
24
|
+
DO_METADATA_URL ||= "/metadata/v1.json".freeze
|
25
25
|
|
26
26
|
def http_client
|
27
27
|
Net::HTTP.start(DO_METADATA_ADDR).tap { |h| h.read_timeout = 6 }
|
@@ -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/http"
|
20
|
+
require "net/http" unless defined?(Net::HTTP)
|
21
21
|
|
22
22
|
module Ohai
|
23
23
|
module Mixin
|
@@ -39,13 +39,13 @@ module Ohai
|
|
39
39
|
#
|
40
40
|
module Ec2Metadata
|
41
41
|
|
42
|
-
EC2_METADATA_ADDR
|
43
|
-
EC2_SUPPORTED_VERSIONS
|
42
|
+
EC2_METADATA_ADDR ||= "169.254.169.254".freeze
|
43
|
+
EC2_SUPPORTED_VERSIONS ||= %w{ 1.0 2007-01-19 2007-03-01 2007-08-29 2007-10-10 2007-12-15
|
44
44
|
2008-02-01 2008-09-01 2009-04-04 2011-01-01 2011-05-01 2012-01-12
|
45
45
|
2014-02-25 2014-11-05 2015-10-20 2016-04-19 2016-06-30 2016-09-02 }.freeze
|
46
|
-
EC2_ARRAY_VALUES
|
47
|
-
EC2_ARRAY_DIR
|
48
|
-
EC2_JSON_DIR
|
46
|
+
EC2_ARRAY_VALUES ||= %w{security-groups local_ipv4s}.freeze
|
47
|
+
EC2_ARRAY_DIR ||= %w{network/interfaces/macs}.freeze
|
48
|
+
EC2_JSON_DIR ||= %w{iam}.freeze
|
49
49
|
|
50
50
|
def best_api_version
|
51
51
|
@api_version ||= begin
|
@@ -14,15 +14,15 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
-
require "net/http"
|
17
|
+
require "net/http" unless defined?(Net::HTTP)
|
18
18
|
|
19
19
|
module Ohai
|
20
20
|
module Mixin
|
21
21
|
module GCEMetadata
|
22
22
|
|
23
23
|
# Trailing dot to host is added to avoid DNS search path
|
24
|
-
GCE_METADATA_ADDR
|
25
|
-
GCE_METADATA_URL
|
24
|
+
GCE_METADATA_ADDR ||= "metadata.google.internal.".freeze
|
25
|
+
GCE_METADATA_URL ||= "/computeMetadata/v1/?recursive=true".freeze
|
26
26
|
|
27
27
|
# fetch the meta content with a timeout and the required header
|
28
28
|
def http_get(uri)
|
@@ -14,14 +14,14 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
|
-
require "net/http"
|
17
|
+
require "net/http" unless defined?(Net::HTTP)
|
18
18
|
|
19
19
|
module Ohai
|
20
20
|
module Mixin
|
21
21
|
module ScalewayMetadata
|
22
22
|
|
23
|
-
SCALEWAY_METADATA_ADDR
|
24
|
-
SCALEWAY_METADATA_URL
|
23
|
+
SCALEWAY_METADATA_ADDR ||= "169.254.42.42".freeze
|
24
|
+
SCALEWAY_METADATA_URL ||= "/conf?format=json".freeze
|
25
25
|
|
26
26
|
# @return [Net::HTTP] net/http object without timeout set to 6
|
27
27
|
def http_client
|
@@ -18,11 +18,11 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
|
20
20
|
require "net/https"
|
21
|
-
require "uri"
|
21
|
+
require "uri" unless defined?(URI)
|
22
22
|
|
23
23
|
# https://softlayer.github.io/reference/services/SoftLayer_Resource_Metadata/
|
24
24
|
module ::Ohai::Mixin::SoftlayerMetadata
|
25
|
-
SOFTLAYER_API_QUERY_URL
|
25
|
+
SOFTLAYER_API_QUERY_URL ||= "https://api.service.softlayer.com/rest/v3.1/SoftLayer_Resource_Metadata".freeze
|
26
26
|
|
27
27
|
# fetch metadata items and build out hash of data
|
28
28
|
#
|
data/lib/ohai/plugin_config.rb
CHANGED
@@ -44,7 +44,7 @@ Ohai.plugin(:Network) do
|
|
44
44
|
iface = Mash.new
|
45
45
|
|
46
46
|
network Mash.new unless network
|
47
|
-
network[:interfaces]
|
47
|
+
network[:interfaces] ||= Mash.new
|
48
48
|
|
49
49
|
# We unfortunately have to do things a bit different here, if ohai is running
|
50
50
|
# within a WPAR. For instance, the WPAR isn't aware of some of its own networking
|
@@ -89,7 +89,7 @@ Ohai.plugin(:Network) do
|
|
89
89
|
netmask = IPAddr.new("255.255.255.255").mask(tmp_prefix.to_i).to_s
|
90
90
|
end
|
91
91
|
|
92
|
-
iface[interface][:addresses]
|
92
|
+
iface[interface][:addresses] ||= Mash.new
|
93
93
|
iface[interface][:addresses][tmp_addr] = { "family" => "inet", "prefixlen" => tmp_prefix }
|
94
94
|
iface[interface][:addresses][tmp_addr][:netmask] = netmask
|
95
95
|
|
@@ -98,7 +98,7 @@ Ohai.plugin(:Network) do
|
|
98
98
|
end
|
99
99
|
elsif lin =~ /inet6 ([a-f0-9\:]+)%?([\d]*)\/?(\d*)?/
|
100
100
|
# TODO do we have more properties on inet6 in aix? broadcast
|
101
|
-
iface[interface][:addresses]
|
101
|
+
iface[interface][:addresses] ||= Mash.new
|
102
102
|
iface[interface][:addresses][$1] = { "family" => "inet6", "zone_index" => $2, "prefixlen" => $3 }
|
103
103
|
else
|
104
104
|
# load all key-values, example "tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1"
|
@@ -113,7 +113,7 @@ Ohai.plugin(:Network) do
|
|
113
113
|
|
114
114
|
# Query macaddress
|
115
115
|
e_so = shell_out("entstat -d #{interface} | grep \"Hardware Address\"")
|
116
|
-
iface[interface][:addresses]
|
116
|
+
iface[interface][:addresses] ||= Mash.new
|
117
117
|
e_so.stdout.lines.each do |l|
|
118
118
|
if l =~ /Hardware Address: (\S+)/
|
119
119
|
iface[interface][:addresses][$1.upcase] = { "family" => "lladdr" }
|
@@ -139,9 +139,9 @@ Ohai.plugin(:Network) do
|
|
139
139
|
so = shell_out("arp -an")
|
140
140
|
count = 0
|
141
141
|
so.stdout.lines.each do |line|
|
142
|
-
network[:arp]
|
142
|
+
network[:arp] ||= Mash.new
|
143
143
|
if line =~ /\s*(\S+) \((\S+)\) at ([a-fA-F0-9\:]+) \[(\w+)\] stored in bucket/
|
144
|
-
network[:arp][count]
|
144
|
+
network[:arp][count] ||= Mash.new
|
145
145
|
network[:arp][count][:remote_host] = $1
|
146
146
|
network[:arp][count][:remote_ip] = $2
|
147
147
|
network[:arp][count][:remote_mac] = $3.downcase
|
data/lib/ohai/plugins/azure.rb
CHANGED
@@ -15,8 +15,8 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
Ohai.plugin(:Azure) do
|
18
|
-
|
19
|
-
|
18
|
+
require_relative "../mixin/azure_metadata"
|
19
|
+
require_relative "../mixin/http_helper"
|
20
20
|
|
21
21
|
include Ohai::Mixin::AzureMetadata
|
22
22
|
include Ohai::Mixin::HttpHelper
|
@@ -20,13 +20,13 @@
|
|
20
20
|
Ohai.plugin(:Virtualization) do
|
21
21
|
provides "virtualization"
|
22
22
|
depends "dmi"
|
23
|
-
|
23
|
+
require_relative "../../mixin/dmi_decode"
|
24
24
|
include Ohai::Mixin::DmiDecode
|
25
25
|
|
26
26
|
collect_data(:freebsd, :openbsd, :netbsd, :dragonflybsd) do
|
27
27
|
|
28
28
|
virtualization Mash.new unless virtualization
|
29
|
-
virtualization[:systems]
|
29
|
+
virtualization[:systems] ||= Mash.new
|
30
30
|
|
31
31
|
# detect when in a jail or when a jail is actively running (not in stopped state)
|
32
32
|
so = shell_out("sysctl -n security.jail.jailed")
|
@@ -87,9 +87,9 @@ Ohai.plugin(:Network) do
|
|
87
87
|
require "scanf"
|
88
88
|
|
89
89
|
network Mash.new unless network
|
90
|
-
network[:interfaces]
|
90
|
+
network[:interfaces] ||= Mash.new
|
91
91
|
counters Mash.new unless counters
|
92
|
-
counters[:network]
|
92
|
+
counters[:network] ||= Mash.new
|
93
93
|
|
94
94
|
so = shell_out("route -n get default")
|
95
95
|
so.stdout.lines do |line|
|
@@ -109,7 +109,8 @@ Ohai.plugin(:Network) do
|
|
109
109
|
so.stdout.lines do |line|
|
110
110
|
if line =~ /^([0-9a-zA-Z\.\:\-]+): \S+ mtu (\d+)$/
|
111
111
|
cint = $1
|
112
|
-
iface[cint]
|
112
|
+
iface[cint] ||= Mash.new
|
113
|
+
iface[cint][:addresses] ||= Mash.new
|
113
114
|
iface[cint][:mtu] = $2
|
114
115
|
if line =~ /\sflags\=\d+\<((UP|BROADCAST|DEBUG|SMART|SIMPLEX|LOOPBACK|POINTOPOINT|NOTRAILERS|RUNNING|NOARP|PROMISC|ALLMULTI|SLAVE|MASTER|MULTICAST|DYNAMIC|,)+)\>\s/
|
115
116
|
flags = $1.split(",")
|
@@ -124,37 +125,37 @@ Ohai.plugin(:Network) do
|
|
124
125
|
end
|
125
126
|
end
|
126
127
|
if line =~ /^\s+ether ([0-9a-f\:]+)/
|
127
|
-
iface[cint][:addresses]
|
128
|
+
iface[cint][:addresses] ||= Mash.new
|
128
129
|
iface[cint][:addresses][$1] = { "family" => "lladdr" }
|
129
130
|
iface[cint][:encapsulation] = "Ethernet"
|
130
131
|
end
|
131
132
|
if line =~ /^\s+lladdr ([0-9a-f\:]+)\s/
|
132
|
-
iface[cint][:addresses]
|
133
|
+
iface[cint][:addresses] ||= Mash.new
|
133
134
|
iface[cint][:addresses][$1] = { "family" => "lladdr" }
|
134
135
|
end
|
135
136
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask 0x(([0-9a-f]){1,8})\s*$/
|
136
|
-
iface[cint][:addresses]
|
137
|
+
iface[cint][:addresses] ||= Mash.new
|
137
138
|
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf("%2x" * 4) * "." }
|
138
139
|
end
|
139
140
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask 0x(([0-9a-f]){1,8}) broadcast (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
|
140
|
-
iface[cint][:addresses]
|
141
|
+
iface[cint][:addresses] ||= Mash.new
|
141
142
|
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2.scanf("%2x" * 4) * ".", "broadcast" => $4 }
|
142
143
|
end
|
143
144
|
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*) prefixlen (\d+)\s*/
|
144
|
-
iface[cint][:addresses]
|
145
|
+
iface[cint][:addresses] ||= Mash.new
|
145
146
|
iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4 , "scope" => scope_lookup($1) }
|
146
147
|
end
|
147
148
|
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*) prefixlen (\d+) scopeid 0x([a-f0-9]+)/
|
148
|
-
iface[cint][:addresses]
|
149
|
+
iface[cint][:addresses] ||= Mash.new
|
149
150
|
iface[cint][:addresses][$1] = { "family" => "inet6", "prefixlen" => $4 , "scope" => scope_lookup($1) }
|
150
151
|
end
|
151
152
|
if line =~ /^\s+media: ((\w+)|(\w+ [a-zA-Z0-9\-\<\>]+)) status: (\w+)/
|
152
|
-
iface[cint][:media]
|
153
|
+
iface[cint][:media] ||= Mash.new
|
153
154
|
iface[cint][:media][:selected] = parse_media($1)
|
154
155
|
iface[cint][:status] = $4
|
155
156
|
end
|
156
157
|
if line =~ /^\s+supported media: (.*)/
|
157
|
-
iface[cint][:media]
|
158
|
+
iface[cint][:media] ||= Mash.new
|
158
159
|
iface[cint][:media][:supported] = parse_media($1)
|
159
160
|
end
|
160
161
|
end
|
@@ -164,7 +165,7 @@ Ohai.plugin(:Network) do
|
|
164
165
|
if line =~ /^\S+ \((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) at ([a-fA-F0-9\:]+) on ([a-zA-Z0-9\.\:\-]+).*\[(\w+)\]/
|
165
166
|
# MAC addr really should be normalized to include all the zeroes.
|
166
167
|
next if iface[$3].nil? # this should never happen
|
167
|
-
iface[$3][:arp]
|
168
|
+
iface[$3][:arp] ||= Mash.new
|
168
169
|
iface[$3][:arp][$1] = $2
|
169
170
|
end
|
170
171
|
end
|
@@ -188,7 +189,7 @@ Ohai.plugin(:Network) do
|
|
188
189
|
line =~ /^([a-zA-Z0-9\.\:\-\*]+)\s+\d+\s+\<[a-zA-Z0-9\#]+\>(\s+)(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/
|
189
190
|
ifname = locate_interface(iface, $1, $2)
|
190
191
|
next if iface[ifname].nil? # this shouldn't happen, but just in case
|
191
|
-
net_counters[ifname]
|
192
|
+
net_counters[ifname] ||= Mash.new
|
192
193
|
net_counters[ifname] = { rx: { bytes: $5, packets: $3, errors: $4, drop: 0, overrun: 0, frame: 0, compressed: 0, multicast: 0 },
|
193
194
|
tx: { bytes: $8, packets: $6, errors: $7, drop: 0, overrun: 0, collisions: $9, carrier: 0, compressed: 0 },
|
194
195
|
}
|
@@ -44,7 +44,7 @@ Ohai.plugin(:Virtualization) do
|
|
44
44
|
|
45
45
|
collect_data(:darwin) do
|
46
46
|
virtualization Mash.new unless virtualization
|
47
|
-
virtualization[:systems]
|
47
|
+
virtualization[:systems] ||= Mash.new
|
48
48
|
|
49
49
|
if docker_exists?
|
50
50
|
virtualization[:system] = "docker"
|
@@ -16,8 +16,8 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
18
|
Ohai.plugin(:DigitalOcean) do
|
19
|
-
|
20
|
-
|
19
|
+
require_relative "../mixin/do_metadata"
|
20
|
+
require_relative "../mixin/http_helper"
|
21
21
|
|
22
22
|
include Ohai::Mixin::DOMetadata
|
23
23
|
include Ohai::Mixin::HttpHelper
|
data/lib/ohai/plugins/dmi.rb
CHANGED
@@ -22,7 +22,7 @@ Ohai.plugin(:DMI) do
|
|
22
22
|
# dmidecode does not return data without access to /dev/mem (or its equivalent)
|
23
23
|
|
24
24
|
collect_data do
|
25
|
-
|
25
|
+
require_relative "../common/dmi"
|
26
26
|
dmi Mash.new
|
27
27
|
|
28
28
|
# all output lines should fall within one of these patterns
|
@@ -82,8 +82,8 @@ Ohai.plugin(:DMI) do
|
|
82
82
|
|
83
83
|
dmi_record = { type: Ohai::Common::DMI.id_lookup(handle[2]) }
|
84
84
|
|
85
|
-
dmi[dmi_record[:type]]
|
86
|
-
dmi[dmi_record[:type]][:all_records]
|
85
|
+
dmi[dmi_record[:type]] ||= Mash.new
|
86
|
+
dmi[dmi_record[:type]][:all_records] ||= []
|
87
87
|
dmi_record[:position] = dmi[dmi_record[:type]][:all_records].length
|
88
88
|
dmi[dmi_record[:type]][:all_records].push(Mash.new)
|
89
89
|
dmi[dmi_record[:type]][:all_records][dmi_record[:position]][:record_id] = handle[1]
|