ohai 8.24.0 → 8.24.1
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 -2
- data/lib/ohai/common/dmi.rb +1 -1
- data/lib/ohai/plugins/darwin/platform.rb +1 -1
- data/lib/ohai/plugins/dmi.rb +4 -4
- data/lib/ohai/plugins/dragonflybsd/network.rb +1 -1
- data/lib/ohai/plugins/freebsd/network.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +14 -10
- data/lib/ohai/plugins/netbsd/network.rb +1 -1
- data/lib/ohai/plugins/openbsd/network.rb +1 -1
- data/lib/ohai/plugins/packages.rb +7 -5
- data/lib/ohai/plugins/rackspace.rb +4 -4
- data/lib/ohai/plugins/solaris2/dmi.rb +4 -4
- data/lib/ohai/plugins/solaris2/network.rb +7 -5
- data/lib/ohai/plugins/uptime.rb +1 -1
- data/lib/ohai/plugins/windows/filesystem.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +2 -2
- data/lib/ohai/runner.rb +1 -1
- data/lib/ohai/system.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/spec/unit/plugins/bsd/virtualization_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d81b8e833f11f3e06f70cb35f22e0947adf105b
|
4
|
+
data.tar.gz: b427c451be6b57ff867e1b43363ae52f7a1d1909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36218913be0e9098697f9fe7369159233cac391b15171288a1d90245d498333477d4a3f1343624c57209c50307cda429c67b798e996c896e0765443266e3fb7b
|
7
|
+
data.tar.gz: 6ec1424381a75fd724f6e69ffd4c54be18efeb60059a6bae5129ea1720ac8bbd77bbff7df497b4bdd89da5b8662fc2a4f0bd7475430c533911a67793599a188a
|
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ gemspec
|
|
5
5
|
group :development do
|
6
6
|
gem "sigar", :platform => "ruby"
|
7
7
|
|
8
|
-
gem "chefstyle", "0.
|
8
|
+
gem "chefstyle", "0.5.0"
|
9
9
|
gem "overcommit", ">= 0.34.1"
|
10
10
|
gem "pry-byebug"
|
11
11
|
gem "pry-stack_explorer"
|
@@ -16,6 +16,6 @@ group :development do
|
|
16
16
|
gem "rspec-mocks", "~> 3.0"
|
17
17
|
gem "rspec-collection_matchers", "~> 1.0"
|
18
18
|
gem "rspec_junit_formatter"
|
19
|
-
gem "github_changelog_generator", git: "https://github.com/
|
19
|
+
gem "github_changelog_generator", git: "https://github.com/chef/github-changelog-generator"
|
20
20
|
gem "activesupport", "< 5.0" if RUBY_VERSION <= "2.2.2" # github_changelog_generator dep
|
21
21
|
end
|
data/lib/ohai/common/dmi.rb
CHANGED
@@ -20,7 +20,7 @@ Ohai.plugin(:Platform) do
|
|
20
20
|
provides "platform", "platform_version", "platform_build", "platform_family"
|
21
21
|
|
22
22
|
collect_data(:darwin) do
|
23
|
-
so = shell_out("#{
|
23
|
+
so = shell_out("#{Ohai.abs_path( "/usr/bin/sw_vers" )}")
|
24
24
|
so.stdout.lines do |line|
|
25
25
|
case line
|
26
26
|
when /^ProductName:\s+(.+)$/
|
data/lib/ohai/plugins/dmi.rb
CHANGED
@@ -91,14 +91,14 @@ Ohai.plugin(:DMI) do
|
|
91
91
|
field = nil
|
92
92
|
|
93
93
|
elsif type = type_line.match(line)
|
94
|
-
if dmi_record
|
94
|
+
if dmi_record.nil?
|
95
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
|
-
if dmi_record
|
101
|
+
if dmi_record.nil?
|
102
102
|
Ohai::Log.debug("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
|
103
103
|
next
|
104
104
|
end
|
@@ -106,11 +106,11 @@ Ohai.plugin(:DMI) do
|
|
106
106
|
field = data[1]
|
107
107
|
|
108
108
|
elsif extended_data = extended_data_line.match(line)
|
109
|
-
if dmi_record
|
109
|
+
if dmi_record.nil?
|
110
110
|
Ohai::Log.debug("Plugin DMI: unexpected extended data line found before header; discarding:\n#{line}")
|
111
111
|
next
|
112
112
|
end
|
113
|
-
if field
|
113
|
+
if field.nil?
|
114
114
|
Ohai::Log.debug("Plugin DMI: unexpected extended data line found outside data section; discarding:\n#{line}")
|
115
115
|
next
|
116
116
|
end
|
@@ -141,9 +141,11 @@ Ohai.plugin(:Network) do
|
|
141
141
|
# using a temporary var to hold routes and their interface name
|
142
142
|
def parse_routes(family, iface)
|
143
143
|
iface.collect do |i, iv|
|
144
|
-
iv[:routes]
|
145
|
-
|
146
|
-
|
144
|
+
if iv[:routes]
|
145
|
+
iv[:routes].collect do |r|
|
146
|
+
r.merge(:dev => i) if r[:family] == family[:name]
|
147
|
+
end.compact
|
148
|
+
end
|
147
149
|
end.compact.flatten
|
148
150
|
end
|
149
151
|
|
@@ -380,7 +382,7 @@ Ohai.plugin(:Network) do
|
|
380
382
|
end
|
381
383
|
|
382
384
|
def interface_address_not_link_level?(iface, address)
|
383
|
-
!iface[:addresses][address][:scope].casecmp("link")
|
385
|
+
!(iface[:addresses][address][:scope].casecmp("link") == 0)
|
384
386
|
end
|
385
387
|
|
386
388
|
def interface_valid_for_route?(iface, address, family)
|
@@ -478,12 +480,14 @@ Ohai.plugin(:Network) do
|
|
478
480
|
:neighbour_attribute => :arp,
|
479
481
|
}]
|
480
482
|
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
483
|
+
if ipv6_enabled?
|
484
|
+
families << {
|
485
|
+
:name => "inet6",
|
486
|
+
:default_route => "::/0",
|
487
|
+
:default_prefix => :default_inet6,
|
488
|
+
:neighbour_attribute => :neighbour_inet6,
|
489
|
+
}
|
490
|
+
end
|
487
491
|
|
488
492
|
parse_ip_addr(iface)
|
489
493
|
|
@@ -39,7 +39,7 @@ Ohai.plugin(:Network) do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
iface = Mash.new
|
42
|
-
so = shell_out( "#{
|
42
|
+
so = shell_out( "#{Ohai.abs_path( "/sbin/ifconfig" )} -a" )
|
43
43
|
cint = nil
|
44
44
|
so.stdout.lines do |line|
|
45
45
|
if line =~ /^([0-9a-zA-Z\.]+):\s+/
|
@@ -22,11 +22,13 @@ Ohai.plugin(:Packages) do
|
|
22
22
|
provides "packages"
|
23
23
|
depends "platform_family"
|
24
24
|
|
25
|
-
WINDOWS_ATTRIBUTE_ALIASES
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
unless defined?(WINDOWS_ATTRIBUTE_ALIASES)
|
26
|
+
WINDOWS_ATTRIBUTE_ALIASES = {
|
27
|
+
"DisplayVersion" => "version",
|
28
|
+
"Publisher" => "publisher",
|
29
|
+
"InstallDate" => "installdate",
|
30
|
+
}
|
31
|
+
end
|
30
32
|
|
31
33
|
collect_data(:linux) do
|
32
34
|
packages Mash.new
|
@@ -38,7 +38,7 @@ Ohai.plugin(:Rackspace) do
|
|
38
38
|
def has_rackspace_metadata?
|
39
39
|
so = shell_out("xenstore-read vm-data/provider_data/provider")
|
40
40
|
if so.exitstatus == 0
|
41
|
-
so.stdout.strip.casecmp("rackspace")
|
41
|
+
so.stdout.strip.casecmp("rackspace") == 0
|
42
42
|
end
|
43
43
|
rescue Ohai::Exceptions::Exec
|
44
44
|
false
|
@@ -84,7 +84,7 @@ Ohai.plugin(:Rackspace) do
|
|
84
84
|
|
85
85
|
# Get the rackspace region
|
86
86
|
#
|
87
|
-
def get_region
|
87
|
+
def get_region
|
88
88
|
so = shell_out("xenstore-ls vm-data/provider_data")
|
89
89
|
if so.exitstatus == 0
|
90
90
|
so.stdout.split("\n").each do |line|
|
@@ -98,7 +98,7 @@ Ohai.plugin(:Rackspace) do
|
|
98
98
|
|
99
99
|
# Get the rackspace instance_id
|
100
100
|
#
|
101
|
-
def get_instance_id
|
101
|
+
def get_instance_id
|
102
102
|
so = shell_out("xenstore-read name")
|
103
103
|
if so.exitstatus == 0
|
104
104
|
rackspace[:instance_id] = so.stdout.gsub(/instance-/, "")
|
@@ -110,7 +110,7 @@ Ohai.plugin(:Rackspace) do
|
|
110
110
|
|
111
111
|
# Get the rackspace private networks
|
112
112
|
#
|
113
|
-
def get_private_networks
|
113
|
+
def get_private_networks
|
114
114
|
so = shell_out("xenstore-ls vm-data/networking")
|
115
115
|
if so.exitstatus == 0
|
116
116
|
networks = []
|
@@ -152,7 +152,7 @@ Ohai.plugin(:DMI) do
|
|
152
152
|
field = nil
|
153
153
|
|
154
154
|
elsif data = data_key_value_line.match(line)
|
155
|
-
if dmi_record
|
155
|
+
if dmi_record.nil?
|
156
156
|
Ohai::Log.debug("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
|
157
157
|
next
|
158
158
|
end
|
@@ -160,7 +160,7 @@ Ohai.plugin(:DMI) do
|
|
160
160
|
field = data[1]
|
161
161
|
|
162
162
|
elsif data = data_key_only_line.match(line)
|
163
|
-
if dmi_record
|
163
|
+
if dmi_record.nil?
|
164
164
|
Ohai::Log.debug("Plugin DMI: unexpected data line found before header; discarding:\n#{line}")
|
165
165
|
next
|
166
166
|
end
|
@@ -168,11 +168,11 @@ Ohai.plugin(:DMI) do
|
|
168
168
|
field = data[1]
|
169
169
|
|
170
170
|
elsif extended_data = extended_data_line.match(line)
|
171
|
-
if dmi_record
|
171
|
+
if dmi_record.nil?
|
172
172
|
Ohai::Log.debug("Plugin DMI: unexpected extended data line found before header; discarding:\n#{line}")
|
173
173
|
next
|
174
174
|
end
|
175
|
-
if field
|
175
|
+
if field.nil?
|
176
176
|
Ohai::Log.debug("Plugin DMI: unexpected extended data line found outside data section; discarding:\n#{line}")
|
177
177
|
next
|
178
178
|
end
|
@@ -54,11 +54,13 @@
|
|
54
54
|
# inet6 fe80::203:baff:fe17:4444/128
|
55
55
|
|
56
56
|
# Extracted from http://illumos.org/hcl/
|
57
|
-
ETHERNET_ENCAPS
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
unless defined?(ETHERNET_ENCAPS)
|
58
|
+
ETHERNET_ENCAPS = %w{ afe amd8111s arn atge ath bfe bge bnx bnxe ce cxgbe
|
59
|
+
dmfe e1000g efe elxl emlxs eri hermon hme hxge igb
|
60
|
+
iprb ipw iwh iwi iwk iwp ixgb ixgbe mwl mxfe myri10ge
|
61
|
+
nge ntxn nxge pcn platform qfe qlc ral rge rtls rtw rwd
|
62
|
+
rwn sfe tavor vr wpi xge yge aggr}
|
63
|
+
end
|
62
64
|
|
63
65
|
Ohai.plugin(:Network) do
|
64
66
|
provides "network", "network/interfaces"
|
data/lib/ohai/plugins/uptime.rb
CHANGED
@@ -74,7 +74,7 @@ Ohai.plugin(:Uptime) do
|
|
74
74
|
|
75
75
|
collect_data(:openbsd) do
|
76
76
|
# kern.boottime=Tue Nov 1 14:45:52 2011
|
77
|
-
so = shell_out("#{
|
77
|
+
so = shell_out("#{Ohai.abs_path( "/sbin/sysctl" )} #kern.boottime")
|
78
78
|
so.stdout.lines do |line|
|
79
79
|
if line =~ /kern.boottime=(.+)/
|
80
80
|
uptime_seconds Time.new.to_i - Time.parse($1).to_i
|
@@ -44,7 +44,7 @@ Ohai.plugin(:Filesystem) do
|
|
44
44
|
fs[filesystem][:kb_used] = fs[filesystem][:kb_size].to_i - fs[filesystem][:kb_available].to_i
|
45
45
|
fs[filesystem][:percent_used] = (fs[filesystem][:kb_size].to_i != 0 ? fs[filesystem][:kb_used].to_i * 100 / fs[filesystem][:kb_size].to_i : 0)
|
46
46
|
fs[filesystem][:mount] = ld_info[filesystem][:name]
|
47
|
-
fs[filesystem][:fs_type] = ld_info[filesystem][:file_system].downcase unless ld_info[filesystem][:file_system]
|
47
|
+
fs[filesystem][:fs_type] = ld_info[filesystem][:file_system].downcase unless ld_info[filesystem][:file_system].nil?
|
48
48
|
fs[filesystem][:volume_name] = ld_info[filesystem][:volume_name]
|
49
49
|
end
|
50
50
|
|
@@ -39,7 +39,7 @@ Ohai.plugin(:Network) do
|
|
39
39
|
# If we are running on windows nano or anothe roperating system from the future
|
40
40
|
# that does not populate the deprecated win32_* WMI classes, then we should
|
41
41
|
# grab data from the newer MSFT_* classes
|
42
|
-
return msft_adapter_data if data[:addresses].count
|
42
|
+
return msft_adapter_data if data[:addresses].count == 0
|
43
43
|
data[:adapters] = wmi.instances_of("Win32_NetworkAdapter")
|
44
44
|
data
|
45
45
|
end
|
@@ -125,7 +125,7 @@ Ohai.plugin(:Network) do
|
|
125
125
|
iface[cint][:type] = iface[cint][:instance][:adapter_type] if iface[cint][:instance][:adapter_type]
|
126
126
|
iface[cint][:arp] = {}
|
127
127
|
iface[cint][:encapsulation] = windows_encaps_lookup(iface[cint][:instance][:adapter_type]) if iface[cint][:instance][:adapter_type]
|
128
|
-
if iface[cint][:configuration][:default_ip_gateway]
|
128
|
+
if !iface[cint][:configuration][:default_ip_gateway].nil? && iface[cint][:configuration][:default_ip_gateway].size > 0
|
129
129
|
network[:default_gateway] = iface[cint][:configuration][:default_ip_gateway].first
|
130
130
|
network[:default_interface] = cint
|
131
131
|
end
|
data/lib/ohai/runner.rb
CHANGED
@@ -69,7 +69,7 @@ module Ohai
|
|
69
69
|
next if next_plugin.has_run?
|
70
70
|
|
71
71
|
if visited.include?(next_plugin)
|
72
|
-
raise Ohai::Exceptions::DependencyCycle, "Dependency cycle detected. Please refer to the following plugins: #{get_cycle(visited, plugin).join(", ")
|
72
|
+
raise Ohai::Exceptions::DependencyCycle, "Dependency cycle detected. Please refer to the following plugins: #{get_cycle(visited, plugin).join(", ")}"
|
73
73
|
end
|
74
74
|
|
75
75
|
dependency_providers = fetch_plugins(next_plugin.dependencies)
|
data/lib/ohai/system.rb
CHANGED
@@ -193,7 +193,7 @@ module Ohai
|
|
193
193
|
end
|
194
194
|
raise ArgumentError, "I cannot find an attribute named #{a}!" if data.nil?
|
195
195
|
case data
|
196
|
-
when Hash, Mash, Array,
|
196
|
+
when Hash, Mash, Array, Integer
|
197
197
|
json_pretty_print(data)
|
198
198
|
when String
|
199
199
|
if data.respond_to?(:lines)
|
data/lib/ohai/version.rb
CHANGED
@@ -23,7 +23,7 @@ describe Ohai::System, "BSD virtualization plugin" do
|
|
23
23
|
@plugin = get_plugin("bsd/virtualization")
|
24
24
|
allow(@plugin).to receive(:collect_os).and_return(:freebsd)
|
25
25
|
allow(@plugin).to receive(:shell_out).with("sysctl -n security.jail.jailed").and_return(mock_shell_out(0, "0", ""))
|
26
|
-
allow(@plugin).to receive(:shell_out).with("#{
|
26
|
+
allow(@plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/sbin/kldstat" )}").and_return(mock_shell_out(0, "", ""))
|
27
27
|
allow(@plugin).to receive(:shell_out).with("jls -nd").and_return(mock_shell_out(0, "", ""))
|
28
28
|
allow(@plugin).to receive(:shell_out).with("sysctl -n hw.model").and_return(mock_shell_out(0, "", ""))
|
29
29
|
allow(@plugin).to receive(:shell_out).with("sysctl -n kern.vm_guest").and_return(mock_shell_out(0, "", ""))
|
@@ -77,7 +77,7 @@ Id Refs Address Size Name
|
|
77
77
|
1 40 0xffffffff80100000 d20428 kernel
|
78
78
|
7 3 0xffffffff81055000 41e88 vboxguest.ko
|
79
79
|
OUT
|
80
|
-
allow(@plugin).to receive(:shell_out).with("#{
|
80
|
+
allow(@plugin).to receive(:shell_out).with("#{Ohai.abs_path("/sbin/kldstat")}").and_return(mock_shell_out(0, @vbox_guest, ""))
|
81
81
|
end
|
82
82
|
|
83
83
|
it "detects we are a guest" do
|
@@ -25,7 +25,7 @@ describe Ohai::System, "NetBSD kernel plugin" do
|
|
25
25
|
allow(@plugin).to receive(:init_kernel).and_return({})
|
26
26
|
allow(@plugin).to receive(:shell_out).with("uname -i").and_return(mock_shell_out(0, "foo", ""))
|
27
27
|
allow(@plugin).to receive(:shell_out).with("sysctl kern.securelevel").and_return(mock_shell_out(0, "kern.securelevel: 1\n", ""))
|
28
|
-
allow(@plugin).to receive(:shell_out).with("#{
|
28
|
+
allow(@plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/bin/modstat" )}").and_return(mock_shell_out(0, " 1 7 0xc0400000 97f830 kernel", ""))
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should set the kernel_os to the kernel_name value" do
|
@@ -34,7 +34,7 @@ PSRINFO_PV
|
|
34
34
|
allow(File).to receive(:exist?).with("/usr/sbin/smbios").and_return(false)
|
35
35
|
allow(File).to receive(:exist?).with("/usr/sbin/zoneadm").and_return(false)
|
36
36
|
allow(@plugin).to receive(:shell_out).with("/usr/sbin/smbios").and_return(mock_shell_out(0, "", ""))
|
37
|
-
allow(@plugin).to receive(:shell_out).with("#{
|
37
|
+
allow(@plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/sbin/psrinfo" )} -pv").and_return(mock_shell_out(0, "", ""))
|
38
38
|
end
|
39
39
|
|
40
40
|
describe "when we are checking for kvm" do
|
@@ -43,12 +43,12 @@ PSRINFO_PV
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should run psrinfo -pv" do
|
46
|
-
expect(@plugin).to receive(:shell_out).with("#{
|
46
|
+
expect(@plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/sbin/psrinfo" )} -pv")
|
47
47
|
@plugin.run
|
48
48
|
end
|
49
49
|
|
50
50
|
it "Should set kvm guest if psrinfo -pv contains QEMU Virtual CPU" do
|
51
|
-
allow(@plugin).to receive(:shell_out).with("#{
|
51
|
+
allow(@plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/sbin/psrinfo" )} -pv").and_return(mock_shell_out(0, "QEMU Virtual CPU", ""))
|
52
52
|
@plugin.run
|
53
53
|
expect(@plugin[:virtualization][:system]).to eq("kvm")
|
54
54
|
expect(@plugin[:virtualization][:role]).to eq("guest")
|
@@ -56,7 +56,7 @@ PSRINFO_PV
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should not set virtualization if kvm isn't there" do
|
59
|
-
expect(@plugin).to receive(:shell_out).with("#{
|
59
|
+
expect(@plugin).to receive(:shell_out).with("#{Ohai.abs_path( "/usr/sbin/psrinfo" )} -pv").and_return(mock_shell_out(0, @psrinfo_pv, ""))
|
60
60
|
@plugin.run
|
61
61
|
expect(@plugin[:virtualization][:systems]).to eq({})
|
62
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.24.
|
4
|
+
version: 8.24.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|