ohai 14.15.0 → 15.0.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/ohai/application.rb +0 -4
- data/lib/ohai/common/dmi.rb +43 -43
- data/lib/ohai/config.rb +1 -1
- data/lib/ohai/loader.rb +32 -47
- data/lib/ohai/mixin/dmi_decode.rb +29 -32
- data/lib/ohai/mixin/os.rb +0 -2
- data/lib/ohai/mixin/softlayer_metadata.rb +5 -5
- data/lib/ohai/plugins/aix/virtualization.rb +4 -4
- data/lib/ohai/plugins/bsd/virtualization.rb +10 -12
- data/lib/ohai/plugins/c.rb +0 -20
- data/lib/ohai/plugins/elixir.rb +13 -13
- data/lib/ohai/plugins/filesystem.rb +10 -10
- data/lib/ohai/plugins/gce.rb +42 -8
- data/lib/ohai/plugins/go.rb +11 -11
- data/lib/ohai/plugins/groovy.rb +12 -12
- data/lib/ohai/plugins/hostname.rb +9 -2
- data/lib/ohai/plugins/linux/fips.rb +2 -9
- data/lib/ohai/plugins/linux/memory.rb +5 -0
- data/lib/ohai/plugins/linux/network.rb +1 -1
- data/lib/ohai/plugins/linux/platform.rb +84 -83
- data/lib/ohai/plugins/linux/systemd_paths.rb +0 -3
- data/lib/ohai/plugins/linux/virtualization.rb +10 -20
- data/lib/ohai/plugins/lua.rb +13 -13
- data/lib/ohai/plugins/mono.rb +23 -23
- data/lib/ohai/plugins/nodejs.rb +13 -13
- data/lib/ohai/plugins/openstack.rb +1 -1
- data/lib/ohai/plugins/packages.rb +1 -28
- data/lib/ohai/plugins/perl.rb +17 -17
- data/lib/ohai/plugins/php.rb +22 -22
- data/lib/ohai/plugins/powershell.rb +30 -30
- data/lib/ohai/plugins/ps.rb +1 -1
- data/lib/ohai/plugins/python.rb +15 -15
- data/lib/ohai/plugins/rust.rb +11 -11
- data/lib/ohai/plugins/solaris2/dmi.rb +48 -48
- data/lib/ohai/plugins/solaris2/virtualization.rb +8 -10
- data/lib/ohai/plugins/virtualbox.rb +21 -21
- data/lib/ohai/plugins/windows/filesystem.rb +2 -2
- data/lib/ohai/plugins/windows/fips.rb +2 -21
- data/lib/ohai/plugins/windows/virtualization.rb +9 -35
- data/lib/ohai/runner.rb +2 -2
- data/lib/ohai/system.rb +0 -17
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +2 -2
- data/spec/data/plugins/rpmquery.output +0 -2
- data/spec/functional/application_spec.rb +1 -1
- data/spec/functional/loader_spec.rb +2 -2
- data/spec/functional/plugins/powershell_spec.rb +2 -2
- data/spec/functional/plugins/root_group_spec.rb +1 -1
- data/spec/functional/plugins/windows/uptime_spec.rb +2 -2
- data/spec/ohai_spec.rb +1 -1
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/dsl/plugin_spec.rb +1 -1
- data/spec/unit/hints_spec.rb +2 -2
- data/spec/unit/loader_spec.rb +12 -12
- data/spec/unit/mixin/azure_metadata_spec.rb +1 -1
- data/spec/unit/mixin/command_spec.rb +1 -1
- data/spec/unit/mixin/dmi_decode.rb +68 -0
- data/spec/unit/mixin/ec2_metadata_spec.rb +1 -1
- data/spec/unit/mixin/softlayer_metadata_spec.rb +1 -1
- data/spec/unit/plugin_config_spec.rb +1 -1
- data/spec/unit/plugins/abort_spec.rb +9 -9
- data/spec/unit/plugins/aix/cpu_spec.rb +4 -4
- data/spec/unit/plugins/aix/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/aix/hostname_spec.rb +1 -1
- data/spec/unit/plugins/aix/kernel_spec.rb +1 -1
- data/spec/unit/plugins/aix/memory_spec.rb +1 -1
- data/spec/unit/plugins/aix/network_spec.rb +6 -6
- data/spec/unit/plugins/aix/platform_spec.rb +1 -1
- data/spec/unit/plugins/aix/uptime_spec.rb +1 -1
- data/spec/unit/plugins/aix/virtualization_spec.rb +2 -2
- data/spec/unit/plugins/azure_spec.rb +1 -1
- data/spec/unit/plugins/bsd/filesystem_spec.rb +4 -4
- data/spec/unit/plugins/bsd/virtualization_spec.rb +3 -3
- data/spec/unit/plugins/c_spec.rb +1 -53
- data/spec/unit/plugins/chef_spec.rb +1 -1
- data/spec/unit/plugins/cloud_spec.rb +1 -1
- data/spec/unit/plugins/darwin/cpu_spec.rb +2 -2
- data/spec/unit/plugins/darwin/filesystem_spec.rb +5 -5
- data/spec/unit/plugins/darwin/hardware_spec.rb +2 -2
- data/spec/unit/plugins/darwin/hardware_system_profiler_output.rb +3 -3
- data/spec/unit/plugins/darwin/hostname_spec.rb +1 -1
- data/spec/unit/plugins/darwin/kernel_spec.rb +1 -1
- data/spec/unit/plugins/darwin/memory_spec.rb +1 -1
- data/spec/unit/plugins/darwin/network_spec.rb +1 -1
- data/spec/unit/plugins/darwin/platform_spec.rb +1 -1
- data/spec/unit/plugins/darwin/virtualization_spec.rb +1 -1
- data/spec/unit/plugins/dmi_spec.rb +1 -1
- data/spec/unit/plugins/docker_spec.rb +1 -1
- data/spec/unit/plugins/ec2_spec.rb +1 -1
- data/spec/unit/plugins/elixir_spec.rb +1 -1
- data/spec/unit/plugins/erlang_spec.rb +1 -1
- data/spec/unit/plugins/eucalyptus_spec.rb +1 -1
- data/spec/unit/plugins/fail_spec.rb +28 -28
- data/spec/unit/plugins/freebsd/cpu_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/freebsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/gce_spec.rb +1 -1
- data/spec/unit/plugins/go_spec.rb +1 -1
- data/spec/unit/plugins/groovy_spec.rb +1 -1
- data/spec/unit/plugins/haskell_spec.rb +1 -1
- data/spec/unit/plugins/hostname_spec.rb +68 -1
- data/spec/unit/plugins/init_package_spec.rb +1 -1
- data/spec/unit/plugins/java_spec.rb +1 -1
- data/spec/unit/plugins/joyent_spec.rb +3 -3
- data/spec/unit/plugins/kernel_spec.rb +1 -1
- data/spec/unit/plugins/linode_spec.rb +1 -1
- data/spec/unit/plugins/linux/block_device_spec.rb +1 -1
- data/spec/unit/plugins/linux/cpu_spec.rb +6 -6
- data/spec/unit/plugins/linux/filesystem_spec.rb +21 -21
- data/spec/unit/plugins/linux/fips_spec.rb +13 -45
- data/spec/unit/plugins/linux/hostname_spec.rb +1 -1
- data/spec/unit/plugins/linux/hostnamectl_spec.rb +2 -2
- data/spec/unit/plugins/linux/kernel_spec.rb +8 -8
- data/spec/unit/plugins/linux/lsb_spec.rb +3 -3
- data/spec/unit/plugins/linux/lspci_spec.rb +2 -2
- data/spec/unit/plugins/linux/machineid_spec.rb +1 -1
- data/spec/unit/plugins/linux/mdadm_spec.rb +2 -2
- data/spec/unit/plugins/linux/memory_spec.rb +26 -1
- data/spec/unit/plugins/linux/network_spec.rb +37 -37
- data/spec/unit/plugins/linux/platform_spec.rb +580 -837
- data/spec/unit/plugins/linux/sessions_spec.rb +2 -2
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +1 -1
- data/spec/unit/plugins/linux/uptime_spec.rb +1 -1
- data/spec/unit/plugins/linux/virtualization_spec.rb +28 -227
- data/spec/unit/plugins/lua_spec.rb +1 -1
- data/spec/unit/plugins/mono_spec.rb +2 -2
- data/spec/unit/plugins/netbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/netbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/network_spec.rb +11 -11
- data/spec/unit/plugins/nodejs_spec.rb +1 -1
- data/spec/unit/plugins/ohai_spec.rb +1 -1
- data/spec/unit/plugins/ohai_time_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/hostname_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/kernel_spec.rb +1 -1
- data/spec/unit/plugins/openbsd/platform_spec.rb +1 -1
- data/spec/unit/plugins/openstack_spec.rb +8 -4
- data/spec/unit/plugins/os_spec.rb +1 -1
- data/spec/unit/plugins/packages_spec.rb +1 -21
- data/spec/unit/plugins/passwd_spec.rb +1 -1
- data/spec/unit/plugins/perl_spec.rb +1 -1
- data/spec/unit/plugins/php_spec.rb +6 -6
- data/spec/unit/plugins/platform_spec.rb +1 -1
- data/spec/unit/plugins/powershell_spec.rb +3 -3
- data/spec/unit/plugins/python_spec.rb +1 -1
- data/spec/unit/plugins/rackspace_spec.rb +2 -2
- data/spec/unit/plugins/root_group_spec.rb +1 -11
- data/spec/unit/plugins/ruby_spec.rb +1 -1
- data/spec/unit/plugins/rust_spec.rb +1 -1
- data/spec/unit/plugins/scala_spec.rb +1 -1
- data/spec/unit/plugins/scsi_spec.rb +2 -2
- data/spec/unit/plugins/shard_spec.rb +1 -1
- data/spec/unit/plugins/shells_spec.rb +1 -1
- data/spec/unit/plugins/softlayer_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/cpu_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/dmi_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/filesystem.rb +4 -4
- data/spec/unit/plugins/solaris2/hostname_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/kernel_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/memory_spec.rb +1 -1
- data/spec/unit/plugins/solaris2/network_spec.rb +6 -6
- data/spec/unit/plugins/solaris2/platform_spec.rb +3 -3
- data/spec/unit/plugins/solaris2/virtualization_spec.rb +41 -69
- data/spec/unit/plugins/ssh_host_keys_spec.rb +3 -3
- data/spec/unit/plugins/sysconf_spec.rb +2 -2
- data/spec/unit/plugins/timezone_spec.rb +1 -1
- data/spec/unit/plugins/virtualbox_spec.rb +1 -1
- data/spec/unit/plugins/vmware_spec.rb +1 -1
- data/spec/unit/plugins/windows/cpu_spec.rb +1 -2
- data/spec/unit/plugins/windows/filesystem_spec.rb +2 -2
- data/spec/unit/plugins/windows/fips_spec.rb +17 -77
- data/spec/unit/plugins/windows/kernel_spec.rb +1 -1
- data/spec/unit/plugins/windows/memory_spec.rb +2 -2
- data/spec/unit/plugins/windows/network_spec.rb +1 -1
- data/spec/unit/plugins/windows/system_enclosure_spec.rb +1 -1
- data/spec/unit/plugins/windows/uptime_spec.rb +1 -1
- data/spec/unit/plugins/windows/virtualization_spec.rb +20 -238
- data/spec/unit/plugins/zpools_spec.rb +7 -7
- data/spec/unit/provides_map_spec.rb +1 -1
- data/spec/unit/runner_spec.rb +1 -1
- data/spec/unit/system_spec.rb +10 -77
- data/spec/unit/util/file_helper_spec.rb +1 -1
- data/spec/unit/util/ip_helper_spec.rb +1 -1
- metadata +6 -9
- data/lib/ohai/plugins/darwin/system_profiler.rb +0 -72
- data/lib/ohai/util/win32/group_helper.rb +0 -76
- data/spec/unit/plugins/darwin/system_profiler_output.rb +0 -79524
- data/spec/unit/plugins/darwin/system_profiler_spec.rb +0 -40
@@ -35,57 +35,57 @@ Ohai.plugin(:DMI) do
|
|
35
35
|
# this is what the *real* IDs are:
|
36
36
|
# pulled from http://src.opensolaris.org/source/xref/nwam/nwam1/usr/src/uts/common/sys/smbios.h
|
37
37
|
smb_to_id = {
|
38
|
-
"SMB_TYPE_BIOS" =>
|
39
|
-
"SMB_TYPE_SYSTEM" =>
|
40
|
-
"SMB_TYPE_BASEBOARD" =>
|
41
|
-
"SMB_TYPE_CHASSIS" =>
|
42
|
-
"SMB_TYPE_PROCESSOR" =>
|
43
|
-
"SMB_TYPE_MEMCTL" =>
|
44
|
-
"SMB_TYPE_MEMMOD" =>
|
45
|
-
"SMB_TYPE_CACHE" =>
|
46
|
-
"SMB_TYPE_PORT" =>
|
47
|
-
"SMB_TYPE_SLOT" =>
|
48
|
-
"SMB_TYPE_OBDEVS" =>
|
49
|
-
"SMB_TYPE_OEMSTR" =>
|
50
|
-
"SMB_TYPE_SYSCONFSTR" =>
|
51
|
-
"SMB_TYPE_LANG" =>
|
52
|
-
"SMB_TYPE_GROUP" =>
|
53
|
-
"SMB_TYPE_EVENTLOG" =>
|
54
|
-
"SMB_TYPE_MEMARRAY" =>
|
55
|
-
"SMB_TYPE_MEMDEVICE" =>
|
56
|
-
"SMB_TYPE_MEMERR32" =>
|
57
|
-
"SMB_TYPE_MEMARRAYMAP" =>
|
38
|
+
"SMB_TYPE_BIOS" => 0, # BIOS information (R)
|
39
|
+
"SMB_TYPE_SYSTEM" => 1, # system information (R)
|
40
|
+
"SMB_TYPE_BASEBOARD" => 2, # base board
|
41
|
+
"SMB_TYPE_CHASSIS" => 3, # system enclosure or chassis (R)
|
42
|
+
"SMB_TYPE_PROCESSOR" => 4, # processor (R)
|
43
|
+
"SMB_TYPE_MEMCTL" => 5, # memory controller (O)
|
44
|
+
"SMB_TYPE_MEMMOD" => 6, # memory module (O)
|
45
|
+
"SMB_TYPE_CACHE" => 7, # processor cache (R)
|
46
|
+
"SMB_TYPE_PORT" => 8, # port connector
|
47
|
+
"SMB_TYPE_SLOT" => 9, # upgradeable system slot (R)
|
48
|
+
"SMB_TYPE_OBDEVS" => 10, # on-board devices
|
49
|
+
"SMB_TYPE_OEMSTR" => 11, # OEM string table
|
50
|
+
"SMB_TYPE_SYSCONFSTR" => 12, # system configuration string table
|
51
|
+
"SMB_TYPE_LANG" => 13, # BIOS language information
|
52
|
+
"SMB_TYPE_GROUP" => 14, # group associations
|
53
|
+
"SMB_TYPE_EVENTLOG" => 15, # system event log
|
54
|
+
"SMB_TYPE_MEMARRAY" => 16, # physical memory array (R)
|
55
|
+
"SMB_TYPE_MEMDEVICE" => 17, # memory device (R)
|
56
|
+
"SMB_TYPE_MEMERR32" => 18, # 32-bit memory error information
|
57
|
+
"SMB_TYPE_MEMARRAYMAP" => 19, # memory array mapped address (R)
|
58
58
|
"SMB_TYPE_MEMDEVICEMAP" => 20, # memory device mapped address (R)
|
59
|
-
"SMB_TYPE_POINTDEV" =>
|
60
|
-
"SMB_TYPE_BATTERY" =>
|
61
|
-
"SMB_TYPE_RESET" =>
|
62
|
-
"SMB_TYPE_SECURITY" =>
|
63
|
-
"SMB_TYPE_POWERCTL" =>
|
64
|
-
"SMB_TYPE_VPROBE" =>
|
65
|
-
"SMB_TYPE_COOLDEV" =>
|
66
|
-
"SMB_TYPE_TPROBE" =>
|
67
|
-
"SMB_TYPE_IPROBE" =>
|
68
|
-
"SMB_TYPE_OOBRA" =>
|
69
|
-
"SMB_TYPE_BIS" =>
|
70
|
-
"SMB_TYPE_BOOT" =>
|
71
|
-
"SMB_TYPE_MEMERR64" =>
|
72
|
-
"SMB_TYPE_MGMTDEV" =>
|
73
|
-
"SMB_TYPE_MGMTDEVCP" =>
|
74
|
-
"SMB_TYPE_MGMTDEVDATA" =>
|
75
|
-
"SMB_TYPE_MEMCHAN" =>
|
76
|
-
"SMB_TYPE_IPMIDEV" =>
|
77
|
-
"SMB_TYPE_POWERSUP" =>
|
78
|
-
"SMB_TYPE_ADDINFO" =>
|
79
|
-
"SMB_TYPE_OBDEVEXT" =>
|
80
|
-
"SMB_TYPE_MCHI" =>
|
81
|
-
"SMB_TYPE_INACTIVE" =>
|
82
|
-
"SMB_TYPE_EOT" =>
|
83
|
-
"SMB_TYPE_OEM_LO" =>
|
59
|
+
"SMB_TYPE_POINTDEV" => 21, # built-in pointing device
|
60
|
+
"SMB_TYPE_BATTERY" => 22, # portable battery
|
61
|
+
"SMB_TYPE_RESET" => 23, # system reset settings
|
62
|
+
"SMB_TYPE_SECURITY" => 24, # hardware security settings
|
63
|
+
"SMB_TYPE_POWERCTL" => 25, # system power controls
|
64
|
+
"SMB_TYPE_VPROBE" => 26, # voltage probe
|
65
|
+
"SMB_TYPE_COOLDEV" => 27, # cooling device
|
66
|
+
"SMB_TYPE_TPROBE" => 28, # temperature probe
|
67
|
+
"SMB_TYPE_IPROBE" => 29, # current probe
|
68
|
+
"SMB_TYPE_OOBRA" => 30, # out-of-band remote access facility
|
69
|
+
"SMB_TYPE_BIS" => 31, # boot integrity services
|
70
|
+
"SMB_TYPE_BOOT" => 32, # system boot status (R)
|
71
|
+
"SMB_TYPE_MEMERR64" => 33, # 64-bit memory error information
|
72
|
+
"SMB_TYPE_MGMTDEV" => 34, # management device
|
73
|
+
"SMB_TYPE_MGMTDEVCP" => 35, # management device component
|
74
|
+
"SMB_TYPE_MGMTDEVDATA" => 36, # management device threshold data
|
75
|
+
"SMB_TYPE_MEMCHAN" => 37, # memory channel
|
76
|
+
"SMB_TYPE_IPMIDEV" => 38, # IPMI device information
|
77
|
+
"SMB_TYPE_POWERSUP" => 39, # system power supply
|
78
|
+
"SMB_TYPE_ADDINFO" => 40, # additional information
|
79
|
+
"SMB_TYPE_OBDEVEXT" => 41, # on-board device extended info
|
80
|
+
"SMB_TYPE_MCHI" => 42, # mgmt controller host interface
|
81
|
+
"SMB_TYPE_INACTIVE" => 126, # inactive table entry
|
82
|
+
"SMB_TYPE_EOT" => 127, # end of table
|
83
|
+
"SMB_TYPE_OEM_LO" => 128, # start of OEM-specific type range
|
84
84
|
"SUN_OEM_EXT_PROCESSOR" => 132, # processor extended info
|
85
|
-
"SUN_OEM_PCIEXRC" =>
|
86
|
-
"SUN_OEM_EXT_MEMARRAY" =>
|
85
|
+
"SUN_OEM_PCIEXRC" => 138, # PCIE RootComplex/RootPort info
|
86
|
+
"SUN_OEM_EXT_MEMARRAY" => 144, # phys memory array extended info
|
87
87
|
"SUN_OEM_EXT_MEMDEVICE" => 145, # memory device extended info
|
88
|
-
"SMB_TYPE_OEM_HI" =>
|
88
|
+
"SMB_TYPE_OEM_HI" => 256, # end of OEM-specific type range
|
89
89
|
}
|
90
90
|
|
91
91
|
# all output lines should fall within one of these patterns
|
@@ -22,6 +22,7 @@ Ohai.plugin(:Virtualization) do
|
|
22
22
|
require "ohai/mixin/dmi_decode"
|
23
23
|
include Ohai::Mixin::DmiDecode
|
24
24
|
provides "virtualization"
|
25
|
+
depends "dmi"
|
25
26
|
|
26
27
|
def collect_solaris_guestid
|
27
28
|
command = "/usr/sbin/zoneadm list -p"
|
@@ -44,16 +45,13 @@ Ohai.plugin(:Virtualization) do
|
|
44
45
|
end
|
45
46
|
end
|
46
47
|
|
47
|
-
#
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
virtualization[:role] = "guest"
|
55
|
-
virtualization[:systems][guest.to_sym] = "guest"
|
56
|
-
end
|
48
|
+
# parse dmi to discover various virtualization guests
|
49
|
+
guest = guest_from_dmi_data(get_attribute(:dmi, :system, :manufacturer), get_attribute(:dmi, :system, :product), get_attribute(:dmi, :system, :version))
|
50
|
+
if guest
|
51
|
+
logger.trace("Plugin Virtualization: DMI data indicates #{guest} guest")
|
52
|
+
virtualization[:system] = guest
|
53
|
+
virtualization[:role] = "guest"
|
54
|
+
virtualization[:systems][guest.to_sym] = "guest"
|
57
55
|
end
|
58
56
|
|
59
57
|
if File.executable?("/usr/sbin/zoneadm")
|
@@ -20,30 +20,30 @@ Ohai.plugin(:Virtualbox) do
|
|
20
20
|
provides "virtualbox"
|
21
21
|
|
22
22
|
collect_data do
|
23
|
-
begin
|
24
|
-
so = shell_out("VBoxControl guestproperty enumerate")
|
25
23
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
24
|
+
so = shell_out("VBoxControl guestproperty enumerate")
|
25
|
+
|
26
|
+
if so.exitstatus == 0
|
27
|
+
virtualbox Mash.new
|
28
|
+
virtualbox[:host] = Mash.new
|
29
|
+
virtualbox[:guest] = Mash.new
|
30
|
+
so.stdout.lines.each do |line|
|
31
|
+
case line
|
32
|
+
when /LanguageID, value: (\S*),/
|
33
|
+
virtualbox[:host][:language] = Regexp.last_match(1)
|
34
|
+
when /VBoxVer, value: (\S*),/
|
35
|
+
virtualbox[:host][:version] = Regexp.last_match(1)
|
36
|
+
when /VBoxRev, value: (\S*),/
|
37
|
+
virtualbox[:host][:revision] = Regexp.last_match(1)
|
38
|
+
when /GuestAdd\/VersionExt, value: (\S*),/
|
39
|
+
virtualbox[:guest][:guest_additions_version] = Regexp.last_match(1)
|
40
|
+
when /GuestAdd\/Revision, value: (\S*),/
|
41
|
+
virtualbox[:guest][:guest_additions_revision] = Regexp.last_match(1)
|
43
42
|
end
|
44
43
|
end
|
45
|
-
rescue Ohai::Exceptions::Exec
|
46
|
-
logger.trace('Plugin Virtualbox: Could not execute "VBoxControl guestproperty enumerate". Skipping data')
|
47
44
|
end
|
45
|
+
rescue Ohai::Exceptions::Exec
|
46
|
+
logger.trace('Plugin Virtualbox: Could not execute "VBoxControl guestproperty enumerate". Skipping data')
|
47
|
+
|
48
48
|
end
|
49
49
|
end
|
@@ -23,8 +23,8 @@ Ohai.plugin(:Filesystem) do
|
|
23
23
|
#
|
24
24
|
# @see https://docs.microsoft.com/en-us/windows/desktop/SecProv/getconversionstatus-win32-encryptablevolume#parameters
|
25
25
|
#
|
26
|
-
CONVERSION_STATUS
|
27
|
-
|
26
|
+
CONVERSION_STATUS = %w{FullyDecrypted FullyEncrypted EncryptionInProgress
|
27
|
+
DecryptionInProgress EncryptionPaused DecryptionPaused}.freeze
|
28
28
|
|
29
29
|
# Returns a Mash loaded with logical details
|
30
30
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Matt Wrock (<matt@mattwrock.com>)
|
3
|
-
# Copyright:: Copyright (c) 2016 Chef Software, Inc.
|
3
|
+
# Copyright:: Copyright (c) 2016-2018 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");
|
@@ -28,30 +28,11 @@ Ohai.plugin(:Fips) do
|
|
28
28
|
collect_data(:windows) do
|
29
29
|
fips Mash.new
|
30
30
|
|
31
|
-
# Check for new fips_mode method added in Ruby 2.5. After we drop support
|
32
|
-
# for Ruby 2.4, clean up everything after this and collapse the FIPS plugins.
|
33
31
|
require "openssl"
|
34
32
|
if defined?(OpenSSL.fips_mode) && OpenSSL.fips_mode && !$FIPS_TEST_MODE
|
35
33
|
fips["kernel"] = { "enabled" => true }
|
36
34
|
else
|
37
|
-
|
38
|
-
# from http://msdn.microsoft.com/en-us/library/windows/desktop/aa384129(v=vs.85).aspx
|
39
|
-
if ::RbConfig::CONFIG["target_cpu"] == "i386"
|
40
|
-
reg_type = Win32::Registry::KEY_READ | 0x100
|
41
|
-
elsif ::RbConfig::CONFIG["target_cpu"] == "x86_64"
|
42
|
-
reg_type = Win32::Registry::KEY_READ | 0x200
|
43
|
-
else
|
44
|
-
reg_type = Win32::Registry::KEY_READ
|
45
|
-
end
|
46
|
-
|
47
|
-
begin
|
48
|
-
Win32::Registry::HKEY_LOCAL_MACHINE.open('System\CurrentControlSet\Control\Lsa\FIPSAlgorithmPolicy', reg_type) do |policy|
|
49
|
-
enabled = policy["Enabled"]
|
50
|
-
fips["kernel"] = { "enabled" => enabled == 0 ? false : true }
|
51
|
-
end
|
52
|
-
rescue Win32::Registry::Error
|
53
|
-
fips["kernel"] = { "enabled" => false }
|
54
|
-
end
|
35
|
+
fips["kernel"] = { "enabled" => false }
|
55
36
|
end
|
56
37
|
end
|
57
38
|
end
|
@@ -20,6 +20,8 @@
|
|
20
20
|
|
21
21
|
Ohai.plugin(:Virtualization) do
|
22
22
|
provides "virtualization"
|
23
|
+
require "ohai/mixin/dmi_decode"
|
24
|
+
include Ohai::Mixin::DmiDecode
|
23
25
|
|
24
26
|
collect_data(:windows) do
|
25
27
|
require "wmi-lite/wmi"
|
@@ -27,44 +29,16 @@ Ohai.plugin(:Virtualization) do
|
|
27
29
|
virtualization Mash.new unless virtualization
|
28
30
|
virtualization[:systems] = Mash.new unless virtualization[:systems]
|
29
31
|
|
30
|
-
# Grab
|
32
|
+
# Grab system DMI data from WMI to determine vendor information
|
31
33
|
wmi = WmiLite::Wmi.new
|
32
|
-
|
34
|
+
dmi = wmi.first_of("Win32_ComputerSystemProduct")
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
guest = guest_from_dmi_data(dmi["vendor"], dmi["name"], dmi["version"])
|
37
|
+
if guest
|
38
|
+
logger.trace("Plugin Virtualization: DMI data in Win32_ComputerSystemProduct indicates #{guest} guest")
|
39
|
+
virtualization[:system] = guest
|
37
40
|
virtualization[:role] = "guest"
|
38
|
-
virtualization[:systems][
|
39
|
-
when "Parallels Software International Inc."
|
40
|
-
virtualization[:system] = "parallels"
|
41
|
-
virtualization[:role] = "guest"
|
42
|
-
virtualization[:systems][:parallels] = "guest"
|
43
|
-
when "Bochs"
|
44
|
-
virtualization[:system] = "kvm"
|
45
|
-
virtualization[:role] = "guest"
|
46
|
-
virtualization[:systems][:kvm] = "guest"
|
47
|
-
when "American Megatrends Inc."
|
48
|
-
if bios[0]["version"] =~ /VRTUAL -/
|
49
|
-
virtualization[:system] = "hyper-v"
|
50
|
-
virtualization[:role] = "guest"
|
51
|
-
virtualization[:systems][:hyperv] = "guest"
|
52
|
-
end
|
53
|
-
when "Xen"
|
54
|
-
virtualization[:system] = "xen"
|
55
|
-
virtualization[:role] = "guest"
|
56
|
-
virtualization[:systems][:xen] = "guest"
|
57
|
-
when "Veertu"
|
58
|
-
virtualization[:system] = "veertu"
|
59
|
-
virtualization[:role] = "guest"
|
60
|
-
virtualization[:systems][:veertu] = "guest"
|
61
|
-
end
|
62
|
-
|
63
|
-
# vmware fusion detection
|
64
|
-
if bios[0]["serialnumber"] =~ /VMware/
|
65
|
-
virtualization[:system] = "vmware"
|
66
|
-
virtualization[:role] = "guest"
|
67
|
-
virtualization[:systems][:vmware] = "guest"
|
41
|
+
virtualization[:systems][guest.to_sym] = "guest"
|
68
42
|
end
|
69
43
|
end
|
70
44
|
end
|
data/lib/ohai/runner.rb
CHANGED
@@ -62,8 +62,8 @@ module Ohai
|
|
62
62
|
|
63
63
|
def run_v7_plugin(plugin)
|
64
64
|
return true if plugin.optional? &&
|
65
|
-
|
66
|
-
|
65
|
+
!Ohai.config[:run_all_plugins] &&
|
66
|
+
!Ohai.config[:optional_plugins].include?(plugin.name)
|
67
67
|
|
68
68
|
visited = [ plugin ]
|
69
69
|
until visited.empty?
|
data/lib/ohai/system.rb
CHANGED
@@ -140,23 +140,6 @@ module Ohai
|
|
140
140
|
freeze_strings!
|
141
141
|
end
|
142
142
|
|
143
|
-
# Re-runs plugins that provide the attributes specified by
|
144
|
-
# +attribute_filter+. If +attribute_filter+ is not given, re-runs all
|
145
|
-
# plugins.
|
146
|
-
#
|
147
|
-
# Note that dependencies will not be re-run, so you must specify all of the
|
148
|
-
# attributes you want refreshed in the +attribute_filter+
|
149
|
-
#
|
150
|
-
# This method takes a naive approach to v6 plugins: it simply re-runs all
|
151
|
-
# of them whenever called.
|
152
|
-
def refresh_plugins(attribute_filter = nil)
|
153
|
-
Ohai::Hints.refresh_hints
|
154
|
-
@provides_map.all_plugins(attribute_filter).each do |plugin|
|
155
|
-
plugin.reset!
|
156
|
-
end
|
157
|
-
run_plugins(true, attribute_filter)
|
158
|
-
end
|
159
|
-
|
160
143
|
#
|
161
144
|
# Serialize this object as a hash
|
162
145
|
#
|
data/lib/ohai/version.rb
CHANGED
data/ohai.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.email = "adam@chef.io"
|
13
13
|
s.homepage = "https://github.com/chef/ohai/"
|
14
14
|
|
15
|
-
s.required_ruby_version = ">= 2.
|
15
|
+
s.required_ruby_version = ">= 2.5"
|
16
16
|
|
17
17
|
s.add_dependency "systemu", "~> 2.6.4"
|
18
18
|
s.add_dependency "ffi-yajl", "~> 2.2"
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_dependency "ipaddress"
|
25
25
|
s.add_dependency "wmi-lite", "~> 1.0"
|
26
26
|
s.add_dependency "ffi", "~> 1.9"
|
27
|
-
s.add_dependency "chef-config", ">= 12.8", "<
|
27
|
+
s.add_dependency "chef-config", ">= 12.8", "< 16"
|
28
28
|
# Note for ohai developers: If chef-config causes you grief, try:
|
29
29
|
# bundle install --with development
|
30
30
|
# this should work as long as chef is a development dependency in Gemfile.
|
@@ -3,5 +3,3 @@ tzdata 0 2016d 1.el7 1463486618 noarch
|
|
3
3
|
nss-softokn-freebl 0 3.16.2.3 14.2.el7_2 1463486619 x86_64
|
4
4
|
glibc 0 2.17 106.el7_2.6 1463486666 x86_64
|
5
5
|
libstdc++ 0 4.8.5 4.el7 1463486669 x86_64
|
6
|
-
kernel 0 3.10.0 862.2.3.el7 1526310781 x86_64
|
7
|
-
kernel 0 3.10.0 862.el7 1521745632 x86_64
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
|
18
|
+
require "spec_helper"
|
19
19
|
|
20
20
|
RSpec.describe "Ohai::Loader" do
|
21
21
|
let(:loader) { Ohai::Loader.new(Ohai::System.new) }
|
@@ -32,7 +32,7 @@ RSpec.describe "Ohai::Loader" do
|
|
32
32
|
Ohai.plugin(:Foo) do
|
33
33
|
provides 'foo'
|
34
34
|
end
|
35
|
-
EOF
|
35
|
+
EOF
|
36
36
|
File.open(File.join(plugin_directory, "foo.rb"), "w+") do |f|
|
37
37
|
f.write(plugin_content)
|
38
38
|
end
|
@@ -16,10 +16,10 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "languages plugin" do
|
22
|
-
VERSION_MATCHING_REGEX = /^(?:[\d]+\.)+[\d]
|
22
|
+
VERSION_MATCHING_REGEX = /^(?:[\d]+\.)+[\d]+$/.freeze
|
23
23
|
describe "powershell plugin", :windows_only do
|
24
24
|
RSpec.shared_examples "a version looking thing" do
|
25
25
|
it "should be present" do
|
@@ -16,7 +16,7 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
19
|
+
require "spec_helper"
|
20
20
|
|
21
21
|
describe Ohai::System, "Windows plugin uptime" do
|
22
22
|
|
@@ -28,7 +28,7 @@ describe Ohai::System, "Windows plugin uptime" do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
let(:wmi) do
|
31
|
-
double("wmi", { first_of:
|
31
|
+
double("wmi", { first_of: { "lastbootuptime" => "20160912103128.597219+0000" },
|
32
32
|
})
|
33
33
|
end
|
34
34
|
|