ohai 15.3.1 → 15.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -6
- data/lib/ohai/mixin/{network_constants.rb → network_helper.rb} +8 -1
- data/lib/ohai/plugins/aix/network.rb +3 -8
- data/lib/ohai/plugins/darwin/network.rb +6 -4
- data/lib/ohai/plugins/filesystem.rb +166 -0
- data/lib/ohai/plugins/network.rb +5 -5
- data/lib/ohai/plugins/openstack.rb +2 -1
- data/lib/ohai/plugins/solaris2/network.rb +6 -4
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +1 -1
- metadata +3 -162
- data/Rakefile +0 -42
- data/lib/ohai/plugins/windows/filesystem.rb +0 -147
- data/spec/data/plugins/dpkg-query.output +0 -4
- data/spec/data/plugins/lslpp.output +0 -50
- data/spec/data/plugins/pacman.output +0 -51
- data/spec/data/plugins/pkg-query.output +0 -58
- data/spec/data/plugins/pkginfo.output +0 -50
- data/spec/data/plugins/pkglist.output +0 -24
- data/spec/data/plugins/rpmquery.output +0 -7
- data/spec/functional/application_spec.rb +0 -107
- data/spec/functional/loader_spec.rb +0 -53
- data/spec/functional/plugins/powershell_spec.rb +0 -88
- data/spec/functional/plugins/root_group_spec.rb +0 -41
- data/spec/functional/plugins/windows/uptime_spec.rb +0 -51
- data/spec/ohai_spec.rb +0 -27
- data/spec/rcov.opts +0 -2
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -124
- data/spec/support/integration_helper.rb +0 -61
- data/spec/support/platform_helpers.rb +0 -38
- data/spec/unit/application_spec.rb +0 -96
- data/spec/unit/config_spec.rb +0 -57
- data/spec/unit/dsl/plugin_spec.rb +0 -634
- data/spec/unit/hints_spec.rb +0 -65
- data/spec/unit/loader_spec.rb +0 -195
- data/spec/unit/mixin/azure_metadata_spec.rb +0 -72
- data/spec/unit/mixin/command_spec.rb +0 -151
- data/spec/unit/mixin/dmi_decode.rb +0 -75
- data/spec/unit/mixin/ec2_metadata_spec.rb +0 -88
- data/spec/unit/mixin/softlayer_metadata_spec.rb +0 -72
- data/spec/unit/plugin_config_spec.rb +0 -117
- data/spec/unit/plugins/abort_spec.rb +0 -69
- data/spec/unit/plugins/aix/cpu_spec.rb +0 -127
- data/spec/unit/plugins/aix/filesystem_spec.rb +0 -238
- data/spec/unit/plugins/aix/hostname_spec.rb +0 -33
- data/spec/unit/plugins/aix/kernel_spec.rb +0 -61
- data/spec/unit/plugins/aix/memory_spec.rb +0 -49
- data/spec/unit/plugins/aix/network_spec.rb +0 -313
- data/spec/unit/plugins/aix/platform_spec.rb +0 -44
- data/spec/unit/plugins/aix/uptime_spec.rb +0 -42
- data/spec/unit/plugins/aix/virtualization_spec.rb +0 -319
- data/spec/unit/plugins/azure_spec.rb +0 -243
- data/spec/unit/plugins/bsd/filesystem_spec.rb +0 -138
- data/spec/unit/plugins/bsd/virtualization_spec.rb +0 -145
- data/spec/unit/plugins/c_spec.rb +0 -341
- data/spec/unit/plugins/chef_spec.rb +0 -44
- data/spec/unit/plugins/cloud_spec.rb +0 -484
- data/spec/unit/plugins/darwin/cpu_spec.rb +0 -124
- data/spec/unit/plugins/darwin/filesystem_spec.rb +0 -140
- data/spec/unit/plugins/darwin/hardware_spec.rb +0 -105
- data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +0 -1110
- data/spec/unit/plugins/darwin/hostname_spec.rb +0 -43
- data/spec/unit/plugins/darwin/kernel_spec.rb +0 -65
- data/spec/unit/plugins/darwin/memory_spec.rb +0 -64
- data/spec/unit/plugins/darwin/network_spec.rb +0 -849
- data/spec/unit/plugins/darwin/platform_spec.rb +0 -71
- data/spec/unit/plugins/darwin/virtualization_spec.rb +0 -156
- data/spec/unit/plugins/digital_ocean_spec.rb +0 -106
- data/spec/unit/plugins/dmi_spec.rb +0 -156
- data/spec/unit/plugins/docker_spec.rb +0 -100
- data/spec/unit/plugins/ec2_spec.rb +0 -452
- data/spec/unit/plugins/elixir_spec.rb +0 -55
- data/spec/unit/plugins/erlang_spec.rb +0 -71
- data/spec/unit/plugins/eucalyptus_spec.rb +0 -109
- data/spec/unit/plugins/fail_spec.rb +0 -260
- data/spec/unit/plugins/freebsd/cpu_spec.rb +0 -129
- data/spec/unit/plugins/freebsd/hostname_spec.rb +0 -35
- data/spec/unit/plugins/freebsd/kernel_spec.rb +0 -36
- data/spec/unit/plugins/freebsd/platform_spec.rb +0 -38
- data/spec/unit/plugins/gce_spec.rb +0 -81
- data/spec/unit/plugins/go_spec.rb +0 -48
- data/spec/unit/plugins/groovy_spec.rb +0 -66
- data/spec/unit/plugins/haskell_spec.rb +0 -231
- data/spec/unit/plugins/hostname_spec.rb +0 -162
- data/spec/unit/plugins/init_package_spec.rb +0 -60
- data/spec/unit/plugins/java_spec.rb +0 -230
- data/spec/unit/plugins/joyent_spec.rb +0 -100
- data/spec/unit/plugins/kernel_spec.rb +0 -38
- data/spec/unit/plugins/linode_spec.rb +0 -135
- data/spec/unit/plugins/linux/block_device_spec.rb +0 -75
- data/spec/unit/plugins/linux/cpu_spec.rb +0 -441
- data/spec/unit/plugins/linux/filesystem_spec.rb +0 -550
- data/spec/unit/plugins/linux/fips_spec.rb +0 -60
- data/spec/unit/plugins/linux/hostname_spec.rb +0 -52
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +0 -59
- data/spec/unit/plugins/linux/kernel_spec.rb +0 -71
- data/spec/unit/plugins/linux/lsb_spec.rb +0 -147
- data/spec/unit/plugins/linux/lspci_spec.rb +0 -133
- data/spec/unit/plugins/linux/machineid_spec.rb +0 -46
- data/spec/unit/plugins/linux/mdadm_spec.rb +0 -170
- data/spec/unit/plugins/linux/memory_spec.rb +0 -256
- data/spec/unit/plugins/linux/network_spec.rb +0 -1392
- data/spec/unit/plugins/linux/platform_spec.rb +0 -812
- data/spec/unit/plugins/linux/sessions_spec.rb +0 -98
- data/spec/unit/plugins/linux/sysctl_spec.rb +0 -53
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +0 -122
- data/spec/unit/plugins/linux/uptime_spec.rb +0 -48
- data/spec/unit/plugins/linux/virtualization_spec.rb +0 -650
- data/spec/unit/plugins/lua_spec.rb +0 -60
- data/spec/unit/plugins/mono_spec.rb +0 -67
- data/spec/unit/plugins/netbsd/hostname_spec.rb +0 -43
- data/spec/unit/plugins/netbsd/kernel_spec.rb +0 -35
- data/spec/unit/plugins/netbsd/platform_spec.rb +0 -38
- data/spec/unit/plugins/network_spec.rb +0 -1078
- data/spec/unit/plugins/nodejs_spec.rb +0 -55
- data/spec/unit/plugins/ohai_spec.rb +0 -32
- data/spec/unit/plugins/ohai_time_spec.rb +0 -44
- data/spec/unit/plugins/openbsd/hostname_spec.rb +0 -43
- data/spec/unit/plugins/openbsd/kernel_spec.rb +0 -36
- data/spec/unit/plugins/openbsd/platform_spec.rb +0 -33
- data/spec/unit/plugins/openstack_spec.rb +0 -311
- data/spec/unit/plugins/os_spec.rb +0 -115
- data/spec/unit/plugins/packages_spec.rb +0 -353
- data/spec/unit/plugins/passwd_spec.rb +0 -65
- data/spec/unit/plugins/perl_spec.rb +0 -62
- data/spec/unit/plugins/php_spec.rb +0 -97
- data/spec/unit/plugins/platform_spec.rb +0 -65
- data/spec/unit/plugins/powershell_spec.rb +0 -71
- data/spec/unit/plugins/python_spec.rb +0 -51
- data/spec/unit/plugins/rackspace_spec.rb +0 -350
- data/spec/unit/plugins/root_group_spec.rb +0 -90
- data/spec/unit/plugins/ruby_spec.rb +0 -60
- data/spec/unit/plugins/rust_spec.rb +0 -43
- data/spec/unit/plugins/scala_spec.rb +0 -58
- data/spec/unit/plugins/scaleway_spec.rb +0 -93
- data/spec/unit/plugins/scsi_spec.rb +0 -69
- data/spec/unit/plugins/shard_spec.rb +0 -121
- data/spec/unit/plugins/shells_spec.rb +0 -56
- data/spec/unit/plugins/softlayer_spec.rb +0 -60
- data/spec/unit/plugins/solaris2/cpu_spec.rb +0 -2926
- data/spec/unit/plugins/solaris2/dmi_spec.rb +0 -153
- data/spec/unit/plugins/solaris2/filesystem.rb +0 -407
- data/spec/unit/plugins/solaris2/hostname_spec.rb +0 -37
- data/spec/unit/plugins/solaris2/kernel_spec.rb +0 -183
- data/spec/unit/plugins/solaris2/memory_spec.rb +0 -43
- data/spec/unit/plugins/solaris2/network_spec.rb +0 -201
- data/spec/unit/plugins/solaris2/platform_spec.rb +0 -108
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +0 -97
- data/spec/unit/plugins/ssh_host_keys_spec.rb +0 -116
- data/spec/unit/plugins/sysconf_spec.rb +0 -680
- data/spec/unit/plugins/timezone_spec.rb +0 -30
- data/spec/unit/plugins/vbox_host_spec.rb +0 -14
- data/spec/unit/plugins/virtualbox_spec.rb +0 -375
- data/spec/unit/plugins/vmware_spec.rb +0 -81
- data/spec/unit/plugins/windows/cpu_spec.rb +0 -118
- data/spec/unit/plugins/windows/filesystem_spec.rb +0 -226
- data/spec/unit/plugins/windows/fips_spec.rb +0 -60
- data/spec/unit/plugins/windows/kernel_spec.rb +0 -79
- data/spec/unit/plugins/windows/memory_spec.rb +0 -52
- data/spec/unit/plugins/windows/network_spec.rb +0 -137
- data/spec/unit/plugins/windows/system_enclosure_spec.rb +0 -45
- data/spec/unit/plugins/windows/uptime_spec.rb +0 -38
- data/spec/unit/plugins/windows/virtualization_spec.rb +0 -63
- data/spec/unit/plugins/zpools_spec.rb +0 -244
- data/spec/unit/provides_map_spec.rb +0 -208
- data/spec/unit/runner_spec.rb +0 -422
- data/spec/unit/system_spec.rb +0 -416
- data/spec/unit/util/file_helper_spec.rb +0 -47
- data/spec/unit/util/ip_helper_spec.rb +0 -128
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 257f27a9e93bbd45470aa2e42c2a9e1e503e8d2e6568a5cbca4d8d964724e854
|
4
|
+
data.tar.gz: aa10fc60bdf94170e7d14f9bf38278974baf68995869c7a9467f45081d193e61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2595eef2b22bcafea6af89415c1ab6566036badb6b8ffba253be3ada2529632ad8210201d38bd5b56d2087cb5b2f2f513479a77ba8e0af5385ade1c250ae50dc
|
7
|
+
data.tar.gz: 4b8c0e3daa5eda327ce6f48f4c7ed34f7e045262e68a3f99c7e78667cc00f15ec4674c37efe4f134c71768841635739cfef06814b598c435cf70cd0d4058ffdb
|
data/Gemfile
CHANGED
@@ -29,9 +29,3 @@ group :debug do
|
|
29
29
|
gem "pry-stack_explorer"
|
30
30
|
gem "rb-readline"
|
31
31
|
end
|
32
|
-
|
33
|
-
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
34
|
-
|
35
|
-
# If you want to load debugging tools into the bundle exec sandbox,
|
36
|
-
# add these additional dependencies into Gemfile.local
|
37
|
-
eval_gemfile(__FILE__ + ".local") if File.exist?(__FILE__ + ".local")
|
@@ -19,11 +19,18 @@
|
|
19
19
|
|
20
20
|
module Ohai
|
21
21
|
module Mixin
|
22
|
-
module
|
22
|
+
module NetworkHelper
|
23
23
|
FAMILIES = {
|
24
24
|
"inet" => "default",
|
25
25
|
"inet6" => "default_inet6",
|
26
26
|
}.freeze
|
27
|
+
|
28
|
+
def hex_to_dec_netmask(netmask)
|
29
|
+
# example 'ffff0000' -> '255.255.0.0'
|
30
|
+
dec = netmask[0..1].to_i(16).to_s(10)
|
31
|
+
[2, 4, 6].each { |n| dec = dec + "." + netmask[n..n + 1].to_i(16).to_s(10) }
|
32
|
+
dec
|
33
|
+
end
|
27
34
|
end
|
28
35
|
end
|
29
36
|
end
|
@@ -20,16 +20,11 @@
|
|
20
20
|
|
21
21
|
Ohai.plugin(:Network) do
|
22
22
|
require "ipaddr"
|
23
|
+
require_relative "../../mixin/network_helper"
|
23
24
|
|
24
25
|
provides "network", "counters/network", "macaddress"
|
25
26
|
|
26
|
-
|
27
|
-
def hex_to_dec_netmask(netmask)
|
28
|
-
# example '0xffff0000' -> '255.255.0.0'
|
29
|
-
dec = netmask[2..3].to_i(16).to_s(10)
|
30
|
-
[4, 6, 8].each { |n| dec = dec + "." + netmask[n..n + 1].to_i(16).to_s(10) }
|
31
|
-
dec
|
32
|
-
end
|
27
|
+
include Ohai::Mixin::NetworkHelper
|
33
28
|
|
34
29
|
collect_data(:aix) do
|
35
30
|
# Loads following information.
|
@@ -80,7 +75,7 @@ Ohai.plugin(:Network) do
|
|
80
75
|
if lin =~ %r{inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(/(\d{1,2}))?}
|
81
76
|
tmp_addr, tmp_prefix = $1, $3
|
82
77
|
if tmp_prefix.nil?
|
83
|
-
netmask = hex_to_dec_netmask($1) if lin =~ /netmask\
|
78
|
+
netmask = hex_to_dec_netmask($1) if lin =~ /netmask\s0x(\S+)\s/
|
84
79
|
unless netmask
|
85
80
|
tmp_prefix ||= "32"
|
86
81
|
netmask = IPAddr.new("255.255.255.255").mask(tmp_prefix.to_i).to_s
|
@@ -17,9 +17,13 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
Ohai.plugin(:Network) do
|
20
|
+
require_relative "../../mixin/network_helper"
|
21
|
+
|
20
22
|
provides "network", "network/interfaces"
|
21
23
|
provides "counters/network", "counters/network/interfaces"
|
22
24
|
|
25
|
+
include Ohai::Mixin::NetworkHelper
|
26
|
+
|
23
27
|
def parse_media(media_string)
|
24
28
|
media = {}
|
25
29
|
line_array = media_string.split(" ")
|
@@ -87,8 +91,6 @@ Ohai.plugin(:Network) do
|
|
87
91
|
end
|
88
92
|
|
89
93
|
collect_data(:darwin) do
|
90
|
-
require "scanf"
|
91
|
-
|
92
94
|
network Mash.new unless network
|
93
95
|
network[:interfaces] ||= Mash.new
|
94
96
|
counters Mash.new unless counters
|
@@ -138,11 +140,11 @@ Ohai.plugin(:Network) do
|
|
138
140
|
end
|
139
141
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask 0x(([0-9a-f]){1,8})\s*$/
|
140
142
|
iface[cint][:addresses] ||= Mash.new
|
141
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2
|
143
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2) }
|
142
144
|
end
|
143
145
|
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})/
|
144
146
|
iface[cint][:addresses] ||= Mash.new
|
145
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2
|
147
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2) , "broadcast" => $4 }
|
146
148
|
end
|
147
149
|
if line =~ /\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*) prefixlen (\d+)\s*/
|
148
150
|
iface[cint][:addresses] ||= Mash.new
|
@@ -107,6 +107,14 @@ Ohai.plugin(:Filesystem) do
|
|
107
107
|
view
|
108
108
|
end
|
109
109
|
|
110
|
+
def generate_deprecated_windows_view(fs)
|
111
|
+
view = generate_mountpoint_view(fs)
|
112
|
+
view.each do |mp, entry|
|
113
|
+
view[mp].delete("devices")
|
114
|
+
end
|
115
|
+
view
|
116
|
+
end
|
117
|
+
|
110
118
|
def generate_deprecated_solaris_view(fs, old_zfs)
|
111
119
|
view = generate_deprecated_view(fs)
|
112
120
|
old_zfs.each do |fsname, attributes|
|
@@ -153,6 +161,143 @@ Ohai.plugin(:Filesystem) do
|
|
153
161
|
logger.warn("Plugin Filesystem: #{bin} binary is not available. Some data will not be available.")
|
154
162
|
end
|
155
163
|
|
164
|
+
### Windows specific methods BEGINS
|
165
|
+
# Volume encryption or decryption status
|
166
|
+
#
|
167
|
+
# @see https://docs.microsoft.com/en-us/windows/desktop/SecProv/getconversionstatus-win32-encryptablevolume#parameters
|
168
|
+
#
|
169
|
+
CONVERSION_STATUS ||= %w{
|
170
|
+
FullyDecrypted FullyEncrypted EncryptionInProgress
|
171
|
+
DecryptionInProgress EncryptionPaused DecryptionPaused
|
172
|
+
}.freeze
|
173
|
+
|
174
|
+
# Returns a Mash loaded with logical details
|
175
|
+
#
|
176
|
+
# Uses Win32_LogicalDisk and logical_properties to return encryption details of volumes.
|
177
|
+
#
|
178
|
+
# Returns an empty Mash in case of any WMI exception.
|
179
|
+
#
|
180
|
+
# @see https://docs.microsoft.com/en-us/windows/desktop/CIMWin32Prov/win32-logicaldisk
|
181
|
+
#
|
182
|
+
# @return [Mash]
|
183
|
+
#
|
184
|
+
def logical_info
|
185
|
+
wmi = WmiLite::Wmi.new("Root\\CIMV2")
|
186
|
+
|
187
|
+
# Note: we should really be parsing Win32_Volume and Win32_Mapped drive.
|
188
|
+
disks = wmi.instances_of("Win32_LogicalDisk")
|
189
|
+
logical_properties(disks)
|
190
|
+
rescue WmiLite::WmiException
|
191
|
+
Ohai::Log.debug("Unable to access Win32_LogicalDisk. Skipping logical details")
|
192
|
+
Mash.new
|
193
|
+
end
|
194
|
+
|
195
|
+
# Returns a Mash loaded with encryption details
|
196
|
+
#
|
197
|
+
# Uses Win32_EncryptableVolume and encryption_properties to return encryption details of volumes.
|
198
|
+
#
|
199
|
+
# Returns an empty Mash in case of any WMI exception.
|
200
|
+
#
|
201
|
+
# @note We are fetching Encryption Status only as of now
|
202
|
+
#
|
203
|
+
# @see https://msdn.microsoft.com/en-us/library/windows/desktop/aa376483(v=vs.85).aspx
|
204
|
+
#
|
205
|
+
# @return [Mash]
|
206
|
+
#
|
207
|
+
def encryptable_info
|
208
|
+
wmi = WmiLite::Wmi.new("Root\\CIMV2\\Security\\MicrosoftVolumeEncryption")
|
209
|
+
disks = wmi.instances_of("Win32_EncryptableVolume")
|
210
|
+
encryption_properties(disks)
|
211
|
+
rescue WmiLite::WmiException
|
212
|
+
Ohai::Log.debug("Unable to access Win32_EncryptableVolume. Skipping encryptable details")
|
213
|
+
Mash.new
|
214
|
+
end
|
215
|
+
|
216
|
+
# Refines and calculates logical properties out of given instances.
|
217
|
+
#
|
218
|
+
# Note that :device here is the same as Volume name and there for compatibility with other OSes.
|
219
|
+
#
|
220
|
+
# @param [WmiLite::Wmi::Instance] disks
|
221
|
+
#
|
222
|
+
# @return [Mash] Each drive containing following properties:
|
223
|
+
#
|
224
|
+
# * :kb_size (Integer)
|
225
|
+
# * :kb_available (Integer)
|
226
|
+
# * :kb_used (Integer)
|
227
|
+
# * :percent_used (Integer)
|
228
|
+
# * :mount (String)
|
229
|
+
# * :fs_type (String)
|
230
|
+
# * :volume_name (String)
|
231
|
+
# * :device (String)
|
232
|
+
#
|
233
|
+
def logical_properties(disks)
|
234
|
+
properties = Mash.new
|
235
|
+
disks.each do |disk|
|
236
|
+
property = Mash.new
|
237
|
+
# In windows the closet thing we have to a device is the volume_name
|
238
|
+
# and the "mountpoint" is the drive letter...
|
239
|
+
device = disk["volume_name"].to_s.downcase
|
240
|
+
mount = disk["deviceid"]
|
241
|
+
property[:kb_size] = disk["size"] ? disk["size"].to_i / 1000 : 0
|
242
|
+
property[:kb_available] = disk["freespace"].to_i / 1000
|
243
|
+
property[:kb_used] = property[:kb_size] - property[:kb_available]
|
244
|
+
property[:percent_used] = (property[:kb_size] == 0 ? 0 : (property[:kb_used] * 100 / property[:kb_size]))
|
245
|
+
property[:mount] = mount
|
246
|
+
property[:fs_type] = disk["filesystem"].to_s.downcase
|
247
|
+
property[:volume_name] = device
|
248
|
+
property[:device] = device
|
249
|
+
|
250
|
+
key = "#{device},#{mount}"
|
251
|
+
properties[key] = property
|
252
|
+
end
|
253
|
+
properties
|
254
|
+
end
|
255
|
+
|
256
|
+
# Refines and calculates encryption properties out of given instances
|
257
|
+
#
|
258
|
+
# @param [WmiLite::Wmi::Instance] disks
|
259
|
+
#
|
260
|
+
# @return [Mash] Each drive containing following properties:
|
261
|
+
#
|
262
|
+
# * :encryption_status (String)
|
263
|
+
#
|
264
|
+
def encryption_properties(disks)
|
265
|
+
properties = Mash.new
|
266
|
+
disks.each do |disk|
|
267
|
+
property = Mash.new
|
268
|
+
property[:encryption_status] = disk["conversionstatus"] ? CONVERSION_STATUS[disk["conversionstatus"]] : ""
|
269
|
+
key = disk["driveletter"]
|
270
|
+
properties[key] = property
|
271
|
+
end
|
272
|
+
properties
|
273
|
+
end
|
274
|
+
|
275
|
+
# Merges all the various properties of filesystems
|
276
|
+
#
|
277
|
+
# @param [Array<Mash>] disks_info
|
278
|
+
# Array of the Mashes containing disk properties
|
279
|
+
#
|
280
|
+
# @return [Mash]
|
281
|
+
#
|
282
|
+
def merge_info(logical_info, encryption_info)
|
283
|
+
fs = Mash.new
|
284
|
+
|
285
|
+
encryption_keys_used = Set.new
|
286
|
+
logical_info.each do |key, info|
|
287
|
+
if encryption_info[info["mount"]]
|
288
|
+
encryption_keys_used.add(info["mount"])
|
289
|
+
fs[key] = info.merge(encryption_info[info["mount"]])
|
290
|
+
else
|
291
|
+
fs[key] = info.dup
|
292
|
+
end
|
293
|
+
end
|
294
|
+
left_enc = encryption_info.reject { |x| encryption_keys_used.include?(x) }
|
295
|
+
left_enc.each do |key, info|
|
296
|
+
fs[",#{key}"] = info
|
297
|
+
end
|
298
|
+
fs
|
299
|
+
end
|
300
|
+
|
156
301
|
collect_data(:linux) do
|
157
302
|
fs = Mash.new
|
158
303
|
|
@@ -599,4 +744,25 @@ Ohai.plugin(:Filesystem) do
|
|
599
744
|
filesystem generate_deprecated_view(fs)
|
600
745
|
filesystem2 fs_data
|
601
746
|
end
|
747
|
+
|
748
|
+
collect_data(:windows) do
|
749
|
+
require "wmi-lite/wmi"
|
750
|
+
require "ohai/mash"
|
751
|
+
|
752
|
+
fs = merge_info(logical_info, encryptable_info)
|
753
|
+
|
754
|
+
by_pair = fs
|
755
|
+
by_device = generate_device_view(fs)
|
756
|
+
by_mountpoint = generate_mountpoint_view(fs)
|
757
|
+
|
758
|
+
fs_data = Mash.new
|
759
|
+
fs_data["by_device"] = by_device
|
760
|
+
fs_data["by_mountpoint"] = by_mountpoint
|
761
|
+
fs_data["by_pair"] = by_pair
|
762
|
+
|
763
|
+
# Set the filesystem data - Windows didn't do the conversion when everyone
|
764
|
+
# else did, so 15 will have both be the new API and 16 will drop the old API
|
765
|
+
filesystem generate_deprecated_windows_view(fs)
|
766
|
+
filesystem2 fs_data
|
767
|
+
end
|
602
768
|
end
|
data/lib/ohai/plugins/network.rb
CHANGED
@@ -18,8 +18,8 @@
|
|
18
18
|
|
19
19
|
Ohai.plugin(:NetworkAddresses) do
|
20
20
|
require "ipaddress"
|
21
|
-
require_relative "../mixin/
|
22
|
-
include Ohai::Mixin::
|
21
|
+
require_relative "../mixin/network_helper"
|
22
|
+
include Ohai::Mixin::NetworkHelper
|
23
23
|
|
24
24
|
provides "ipaddress", "ip6address", "macaddress"
|
25
25
|
|
@@ -69,8 +69,8 @@ Ohai.plugin(:NetworkAddresses) do
|
|
69
69
|
return [ nil, nil ] if ips.empty?
|
70
70
|
|
71
71
|
# shortcuts to access default #{family} interface and gateway
|
72
|
-
int_attr = Ohai::Mixin::
|
73
|
-
gw_attr = Ohai::Mixin::
|
72
|
+
int_attr = Ohai::Mixin::NetworkHelper::FAMILIES[family] + "_interface"
|
73
|
+
gw_attr = Ohai::Mixin::NetworkHelper::FAMILIES[family] + "_gateway"
|
74
74
|
|
75
75
|
if network[int_attr]
|
76
76
|
# working with the address(es) of the default network interface
|
@@ -142,7 +142,7 @@ Ohai.plugin(:NetworkAddresses) do
|
|
142
142
|
counters[:network] ||= Mash.new
|
143
143
|
|
144
144
|
# inet family is processed before inet6 to give ipv4 precedence
|
145
|
-
Ohai::Mixin::
|
145
|
+
Ohai::Mixin::NetworkHelper::FAMILIES.keys.sort.each do |family|
|
146
146
|
r = {}
|
147
147
|
# find the ip/interface with the default route for this family
|
148
148
|
(r["ip"], r["iface"]) = find_ip(family)
|
@@ -45,7 +45,8 @@ Ohai.plugin(:Openstack) do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
# dreamhost systems
|
48
|
+
# dreamhost systems *had* the dhc-user on them < 2016. We should probably remove all this logic
|
49
|
+
# https://help.dreamhost.com/hc/en-us/articles/228377408-How-to-find-the-default-user-of-an-image
|
49
50
|
def openstack_provider
|
50
51
|
# dream host doesn't support windows so bail early if we're on windows
|
51
52
|
return "openstack" if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
@@ -63,9 +63,13 @@ unless defined?(ETHERNET_ENCAPS)
|
|
63
63
|
end
|
64
64
|
|
65
65
|
Ohai.plugin(:Network) do
|
66
|
+
require_relative "../../mixin/network_helper"
|
67
|
+
|
66
68
|
provides "network", "network/interfaces"
|
67
69
|
provides "counters/network", "counters/network/interfaces"
|
68
70
|
|
71
|
+
include Ohai::Mixin::NetworkHelper
|
72
|
+
|
69
73
|
def solaris_encaps_lookup(ifname)
|
70
74
|
return "Ethernet" if ETHERNET_ENCAPS.include?(ifname)
|
71
75
|
return "Ethernet" if ifname.eql?("net")
|
@@ -92,8 +96,6 @@ Ohai.plugin(:Network) do
|
|
92
96
|
end
|
93
97
|
|
94
98
|
collect_data(:solaris2) do
|
95
|
-
require "scanf"
|
96
|
-
|
97
99
|
iface = Mash.new
|
98
100
|
network Mash.new unless network
|
99
101
|
network[:interfaces] ||= Mash.new
|
@@ -124,11 +126,11 @@ Ohai.plugin(:Network) do
|
|
124
126
|
end
|
125
127
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask (([0-9a-f]){1,8})\s*$/
|
126
128
|
iface[cint][:addresses] ||= Mash.new
|
127
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2
|
129
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2) }
|
128
130
|
end
|
129
131
|
if line =~ /\s+inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) netmask (([0-9a-f]){1,8}) broadcast (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/
|
130
132
|
iface[cint][:addresses] ||= Mash.new
|
131
|
-
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => $2
|
133
|
+
iface[cint][:addresses][$1] = { "family" => "inet", "netmask" => hex_to_dec_netmask($2) , "broadcast" => $4 }
|
132
134
|
end
|
133
135
|
if line =~ %r{\s+inet6 ([a-f0-9\:]+)(\s*|(\%[a-z0-9]+)\s*)/(\d+)\s*$}
|
134
136
|
iface[cint][:addresses] ||= Mash.new
|
data/lib/ohai/version.rb
CHANGED
data/ohai.gemspec
CHANGED
@@ -34,5 +34,5 @@ Gem::Specification.new do |s|
|
|
34
34
|
s.executables = %w{ohai}
|
35
35
|
|
36
36
|
s.require_path = "lib"
|
37
|
-
s.files = %w{LICENSE Gemfile
|
37
|
+
s.files = %w{LICENSE Gemfile} + Dir.glob("*.gemspec") + Dir.glob("lib/**/*")
|
38
38
|
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: 15.3
|
4
|
+
version: 15.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|
@@ -197,7 +197,6 @@ extra_rdoc_files: []
|
|
197
197
|
files:
|
198
198
|
- Gemfile
|
199
199
|
- LICENSE
|
200
|
-
- Rakefile
|
201
200
|
- bin/ohai
|
202
201
|
- lib/ohai.rb
|
203
202
|
- lib/ohai/application.rb
|
@@ -219,7 +218,7 @@ files:
|
|
219
218
|
- lib/ohai/mixin/ec2_metadata.rb
|
220
219
|
- lib/ohai/mixin/gce_metadata.rb
|
221
220
|
- lib/ohai/mixin/http_helper.rb
|
222
|
-
- lib/ohai/mixin/
|
221
|
+
- lib/ohai/mixin/network_helper.rb
|
223
222
|
- lib/ohai/mixin/os.rb
|
224
223
|
- lib/ohai/mixin/scaleway_metadata.rb
|
225
224
|
- lib/ohai/mixin/seconds_to_human.rb
|
@@ -329,7 +328,6 @@ files:
|
|
329
328
|
- lib/ohai/plugins/virtualbox.rb
|
330
329
|
- lib/ohai/plugins/vmware.rb
|
331
330
|
- lib/ohai/plugins/windows/drivers.rb
|
332
|
-
- lib/ohai/plugins/windows/filesystem.rb
|
333
331
|
- lib/ohai/plugins/windows/fips.rb
|
334
332
|
- lib/ohai/plugins/windows/memory.rb
|
335
333
|
- lib/ohai/plugins/windows/network.rb
|
@@ -345,163 +343,6 @@ files:
|
|
345
343
|
- lib/ohai/util/win32.rb
|
346
344
|
- lib/ohai/version.rb
|
347
345
|
- ohai.gemspec
|
348
|
-
- spec/data/plugins/dpkg-query.output
|
349
|
-
- spec/data/plugins/lslpp.output
|
350
|
-
- spec/data/plugins/pacman.output
|
351
|
-
- spec/data/plugins/pkg-query.output
|
352
|
-
- spec/data/plugins/pkginfo.output
|
353
|
-
- spec/data/plugins/pkglist.output
|
354
|
-
- spec/data/plugins/rpmquery.output
|
355
|
-
- spec/functional/application_spec.rb
|
356
|
-
- spec/functional/loader_spec.rb
|
357
|
-
- spec/functional/plugins/powershell_spec.rb
|
358
|
-
- spec/functional/plugins/root_group_spec.rb
|
359
|
-
- spec/functional/plugins/windows/uptime_spec.rb
|
360
|
-
- spec/ohai_spec.rb
|
361
|
-
- spec/rcov.opts
|
362
|
-
- spec/spec.opts
|
363
|
-
- spec/spec_helper.rb
|
364
|
-
- spec/support/integration_helper.rb
|
365
|
-
- spec/support/platform_helpers.rb
|
366
|
-
- spec/unit/application_spec.rb
|
367
|
-
- spec/unit/config_spec.rb
|
368
|
-
- spec/unit/dsl/plugin_spec.rb
|
369
|
-
- spec/unit/hints_spec.rb
|
370
|
-
- spec/unit/loader_spec.rb
|
371
|
-
- spec/unit/mixin/azure_metadata_spec.rb
|
372
|
-
- spec/unit/mixin/command_spec.rb
|
373
|
-
- spec/unit/mixin/dmi_decode.rb
|
374
|
-
- spec/unit/mixin/ec2_metadata_spec.rb
|
375
|
-
- spec/unit/mixin/softlayer_metadata_spec.rb
|
376
|
-
- spec/unit/plugin_config_spec.rb
|
377
|
-
- spec/unit/plugins/abort_spec.rb
|
378
|
-
- spec/unit/plugins/aix/cpu_spec.rb
|
379
|
-
- spec/unit/plugins/aix/filesystem_spec.rb
|
380
|
-
- spec/unit/plugins/aix/hostname_spec.rb
|
381
|
-
- spec/unit/plugins/aix/kernel_spec.rb
|
382
|
-
- spec/unit/plugins/aix/memory_spec.rb
|
383
|
-
- spec/unit/plugins/aix/network_spec.rb
|
384
|
-
- spec/unit/plugins/aix/platform_spec.rb
|
385
|
-
- spec/unit/plugins/aix/uptime_spec.rb
|
386
|
-
- spec/unit/plugins/aix/virtualization_spec.rb
|
387
|
-
- spec/unit/plugins/azure_spec.rb
|
388
|
-
- spec/unit/plugins/bsd/filesystem_spec.rb
|
389
|
-
- spec/unit/plugins/bsd/virtualization_spec.rb
|
390
|
-
- spec/unit/plugins/c_spec.rb
|
391
|
-
- spec/unit/plugins/chef_spec.rb
|
392
|
-
- spec/unit/plugins/cloud_spec.rb
|
393
|
-
- spec/unit/plugins/darwin/cpu_spec.rb
|
394
|
-
- spec/unit/plugins/darwin/filesystem_spec.rb
|
395
|
-
- spec/unit/plugins/darwin/hardware_spec.rb
|
396
|
-
- spec/unit/plugins/darwin/hardware_system_profiler_output.rb
|
397
|
-
- spec/unit/plugins/darwin/hostname_spec.rb
|
398
|
-
- spec/unit/plugins/darwin/kernel_spec.rb
|
399
|
-
- spec/unit/plugins/darwin/memory_spec.rb
|
400
|
-
- spec/unit/plugins/darwin/network_spec.rb
|
401
|
-
- spec/unit/plugins/darwin/platform_spec.rb
|
402
|
-
- spec/unit/plugins/darwin/virtualization_spec.rb
|
403
|
-
- spec/unit/plugins/digital_ocean_spec.rb
|
404
|
-
- spec/unit/plugins/dmi_spec.rb
|
405
|
-
- spec/unit/plugins/docker_spec.rb
|
406
|
-
- spec/unit/plugins/ec2_spec.rb
|
407
|
-
- spec/unit/plugins/elixir_spec.rb
|
408
|
-
- spec/unit/plugins/erlang_spec.rb
|
409
|
-
- spec/unit/plugins/eucalyptus_spec.rb
|
410
|
-
- spec/unit/plugins/fail_spec.rb
|
411
|
-
- spec/unit/plugins/freebsd/cpu_spec.rb
|
412
|
-
- spec/unit/plugins/freebsd/hostname_spec.rb
|
413
|
-
- spec/unit/plugins/freebsd/kernel_spec.rb
|
414
|
-
- spec/unit/plugins/freebsd/platform_spec.rb
|
415
|
-
- spec/unit/plugins/gce_spec.rb
|
416
|
-
- spec/unit/plugins/go_spec.rb
|
417
|
-
- spec/unit/plugins/groovy_spec.rb
|
418
|
-
- spec/unit/plugins/haskell_spec.rb
|
419
|
-
- spec/unit/plugins/hostname_spec.rb
|
420
|
-
- spec/unit/plugins/init_package_spec.rb
|
421
|
-
- spec/unit/plugins/java_spec.rb
|
422
|
-
- spec/unit/plugins/joyent_spec.rb
|
423
|
-
- spec/unit/plugins/kernel_spec.rb
|
424
|
-
- spec/unit/plugins/linode_spec.rb
|
425
|
-
- spec/unit/plugins/linux/block_device_spec.rb
|
426
|
-
- spec/unit/plugins/linux/cpu_spec.rb
|
427
|
-
- spec/unit/plugins/linux/filesystem_spec.rb
|
428
|
-
- spec/unit/plugins/linux/fips_spec.rb
|
429
|
-
- spec/unit/plugins/linux/hostname_spec.rb
|
430
|
-
- spec/unit/plugins/linux/hostnamectl_spec.rb
|
431
|
-
- spec/unit/plugins/linux/kernel_spec.rb
|
432
|
-
- spec/unit/plugins/linux/lsb_spec.rb
|
433
|
-
- spec/unit/plugins/linux/lspci_spec.rb
|
434
|
-
- spec/unit/plugins/linux/machineid_spec.rb
|
435
|
-
- spec/unit/plugins/linux/mdadm_spec.rb
|
436
|
-
- spec/unit/plugins/linux/memory_spec.rb
|
437
|
-
- spec/unit/plugins/linux/network_spec.rb
|
438
|
-
- spec/unit/plugins/linux/platform_spec.rb
|
439
|
-
- spec/unit/plugins/linux/sessions_spec.rb
|
440
|
-
- spec/unit/plugins/linux/sysctl_spec.rb
|
441
|
-
- spec/unit/plugins/linux/systemd_paths_spec.rb
|
442
|
-
- spec/unit/plugins/linux/uptime_spec.rb
|
443
|
-
- spec/unit/plugins/linux/virtualization_spec.rb
|
444
|
-
- spec/unit/plugins/lua_spec.rb
|
445
|
-
- spec/unit/plugins/mono_spec.rb
|
446
|
-
- spec/unit/plugins/netbsd/hostname_spec.rb
|
447
|
-
- spec/unit/plugins/netbsd/kernel_spec.rb
|
448
|
-
- spec/unit/plugins/netbsd/platform_spec.rb
|
449
|
-
- spec/unit/plugins/network_spec.rb
|
450
|
-
- spec/unit/plugins/nodejs_spec.rb
|
451
|
-
- spec/unit/plugins/ohai_spec.rb
|
452
|
-
- spec/unit/plugins/ohai_time_spec.rb
|
453
|
-
- spec/unit/plugins/openbsd/hostname_spec.rb
|
454
|
-
- spec/unit/plugins/openbsd/kernel_spec.rb
|
455
|
-
- spec/unit/plugins/openbsd/platform_spec.rb
|
456
|
-
- spec/unit/plugins/openstack_spec.rb
|
457
|
-
- spec/unit/plugins/os_spec.rb
|
458
|
-
- spec/unit/plugins/packages_spec.rb
|
459
|
-
- spec/unit/plugins/passwd_spec.rb
|
460
|
-
- spec/unit/plugins/perl_spec.rb
|
461
|
-
- spec/unit/plugins/php_spec.rb
|
462
|
-
- spec/unit/plugins/platform_spec.rb
|
463
|
-
- spec/unit/plugins/powershell_spec.rb
|
464
|
-
- spec/unit/plugins/python_spec.rb
|
465
|
-
- spec/unit/plugins/rackspace_spec.rb
|
466
|
-
- spec/unit/plugins/root_group_spec.rb
|
467
|
-
- spec/unit/plugins/ruby_spec.rb
|
468
|
-
- spec/unit/plugins/rust_spec.rb
|
469
|
-
- spec/unit/plugins/scala_spec.rb
|
470
|
-
- spec/unit/plugins/scaleway_spec.rb
|
471
|
-
- spec/unit/plugins/scsi_spec.rb
|
472
|
-
- spec/unit/plugins/shard_spec.rb
|
473
|
-
- spec/unit/plugins/shells_spec.rb
|
474
|
-
- spec/unit/plugins/softlayer_spec.rb
|
475
|
-
- spec/unit/plugins/solaris2/cpu_spec.rb
|
476
|
-
- spec/unit/plugins/solaris2/dmi_spec.rb
|
477
|
-
- spec/unit/plugins/solaris2/filesystem.rb
|
478
|
-
- spec/unit/plugins/solaris2/hostname_spec.rb
|
479
|
-
- spec/unit/plugins/solaris2/kernel_spec.rb
|
480
|
-
- spec/unit/plugins/solaris2/memory_spec.rb
|
481
|
-
- spec/unit/plugins/solaris2/network_spec.rb
|
482
|
-
- spec/unit/plugins/solaris2/platform_spec.rb
|
483
|
-
- spec/unit/plugins/solaris2/virtualization_spec.rb
|
484
|
-
- spec/unit/plugins/ssh_host_keys_spec.rb
|
485
|
-
- spec/unit/plugins/sysconf_spec.rb
|
486
|
-
- spec/unit/plugins/timezone_spec.rb
|
487
|
-
- spec/unit/plugins/vbox_host_spec.rb
|
488
|
-
- spec/unit/plugins/virtualbox_spec.rb
|
489
|
-
- spec/unit/plugins/vmware_spec.rb
|
490
|
-
- spec/unit/plugins/windows/cpu_spec.rb
|
491
|
-
- spec/unit/plugins/windows/filesystem_spec.rb
|
492
|
-
- spec/unit/plugins/windows/fips_spec.rb
|
493
|
-
- spec/unit/plugins/windows/kernel_spec.rb
|
494
|
-
- spec/unit/plugins/windows/memory_spec.rb
|
495
|
-
- spec/unit/plugins/windows/network_spec.rb
|
496
|
-
- spec/unit/plugins/windows/system_enclosure_spec.rb
|
497
|
-
- spec/unit/plugins/windows/uptime_spec.rb
|
498
|
-
- spec/unit/plugins/windows/virtualization_spec.rb
|
499
|
-
- spec/unit/plugins/zpools_spec.rb
|
500
|
-
- spec/unit/provides_map_spec.rb
|
501
|
-
- spec/unit/runner_spec.rb
|
502
|
-
- spec/unit/system_spec.rb
|
503
|
-
- spec/unit/util/file_helper_spec.rb
|
504
|
-
- spec/unit/util/ip_helper_spec.rb
|
505
346
|
homepage: https://github.com/chef/ohai/
|
506
347
|
licenses:
|
507
348
|
- Apache-2.0
|