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
@@ -17,9 +17,10 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
Ohai.plugin(:Virtualization) do
|
20
|
+
provides "virtualization"
|
21
|
+
depends "dmi"
|
20
22
|
require "ohai/mixin/dmi_decode"
|
21
23
|
include Ohai::Mixin::DmiDecode
|
22
|
-
provides "virtualization"
|
23
24
|
|
24
25
|
def lxc_version_exists?
|
25
26
|
which("lxc-version") || which("lxc-start")
|
@@ -129,25 +130,14 @@ Ohai.plugin(:Virtualization) do
|
|
129
130
|
virtualization[:systems][:openvz] = "guest"
|
130
131
|
end
|
131
132
|
|
132
|
-
#
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
end
|
141
|
-
|
142
|
-
# parse dmidecode to discover various virtualization guests
|
143
|
-
if File.exist?("/usr/sbin/dmidecode")
|
144
|
-
guest = guest_from_dmi(shell_out("dmidecode").stdout)
|
145
|
-
if guest
|
146
|
-
logger.trace("Plugin Virtualization: dmidecode contains string indicating #{guest} guest")
|
147
|
-
virtualization[:system] = guest
|
148
|
-
virtualization[:role] = "guest"
|
149
|
-
virtualization[:systems][guest.to_sym] = "guest"
|
150
|
-
end
|
133
|
+
# parse dmi to discover various virtualization guests
|
134
|
+
logger.trace("Looking up #{get_attribute(:dmi, :system, :manufacturer)}, #{get_attribute(:dmi, :system, :product)} #{get_attribute(:dmi, :system, :version)}")
|
135
|
+
guest = guest_from_dmi_data(get_attribute(:dmi, :system, :manufacturer), get_attribute(:dmi, :system, :product), get_attribute(:dmi, :system, :version))
|
136
|
+
if guest
|
137
|
+
logger.trace("Plugin Virtualization: DMI data indicates #{guest} guest")
|
138
|
+
virtualization[:system] = guest
|
139
|
+
virtualization[:role] = "guest"
|
140
|
+
virtualization[:systems][guest.to_sym] = "guest"
|
151
141
|
end
|
152
142
|
|
153
143
|
# Detect Hyper-V guest and the hostname of the host
|
data/lib/ohai/plugins/lua.rb
CHANGED
@@ -21,19 +21,19 @@ Ohai.plugin(:Lua) do
|
|
21
21
|
depends "languages"
|
22
22
|
|
23
23
|
collect_data do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
35
|
-
rescue Ohai::Exceptions::Exec
|
36
|
-
logger.trace('Plugin Lua: Could not shell_out "lua -v". Skipping plugin')
|
24
|
+
|
25
|
+
so = shell_out("lua -v")
|
26
|
+
# Sample output:
|
27
|
+
# Lua 5.2.4 Copyright (C) 1994-2015 Lua.org, PUC-Rio
|
28
|
+
if so.exitstatus == 0
|
29
|
+
lua = Mash.new
|
30
|
+
# at some point in lua's history they went from outputting the version
|
31
|
+
# on stderr to doing it on stdout. This handles old / new versions
|
32
|
+
lua[:version] = so.stdout.empty? ? so.stderr.split[1] : so.stdout.split[1]
|
33
|
+
languages[:lua] = lua if lua[:version]
|
37
34
|
end
|
35
|
+
rescue Ohai::Exceptions::Exec
|
36
|
+
logger.trace('Plugin Lua: Could not shell_out "lua -v". Skipping plugin')
|
37
|
+
|
38
38
|
end
|
39
39
|
end
|
data/lib/ohai/plugins/mono.rb
CHANGED
@@ -21,30 +21,30 @@ Ohai.plugin(:Mono) do
|
|
21
21
|
depends "languages"
|
22
22
|
|
23
23
|
collect_data do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
end
|
44
|
-
languages[:mono] = mono unless mono.empty?
|
24
|
+
|
25
|
+
so = shell_out("mono -V")
|
26
|
+
# Sample output:
|
27
|
+
# Mono JIT compiler version 4.2.3 (Stable 4.2.3.4/832de4b Wed Mar 30 13:57:48 PDT 2016)
|
28
|
+
# Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
|
29
|
+
# TLS: normal
|
30
|
+
# SIGSEGV: altstack
|
31
|
+
# Notification: kqueue
|
32
|
+
# Architecture: amd64
|
33
|
+
# Disabled: none
|
34
|
+
# Misc: softtrace
|
35
|
+
# LLVM: supported, not enabled.
|
36
|
+
# GC: sgen
|
37
|
+
if so.exitstatus == 0
|
38
|
+
mono = Mash.new
|
39
|
+
output = so.stdout.split
|
40
|
+
mono[:version] = output[4] unless output[4].nil?
|
41
|
+
if output.length >= 12
|
42
|
+
mono[:builddate] = "%s %s %s %s %s %s" % [output[7], output[8], output[9], output[10], output[11], output[12].delete!(")")]
|
45
43
|
end
|
46
|
-
|
47
|
-
logger.trace('Plugin Mono: Could not shell_out "mono -V". Skipping plugin')
|
44
|
+
languages[:mono] = mono unless mono.empty?
|
48
45
|
end
|
46
|
+
rescue Ohai::Exceptions::Exec
|
47
|
+
logger.trace('Plugin Mono: Could not shell_out "mono -V". Skipping plugin')
|
48
|
+
|
49
49
|
end
|
50
50
|
end
|
data/lib/ohai/plugins/nodejs.rb
CHANGED
@@ -21,20 +21,20 @@ Ohai.plugin(:Nodejs) do
|
|
21
21
|
depends "languages"
|
22
22
|
|
23
23
|
collect_data do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
34
|
-
languages[:nodejs] = nodejs if nodejs[:version]
|
24
|
+
|
25
|
+
so = shell_out("node -v")
|
26
|
+
# Sample output:
|
27
|
+
# v5.10.1
|
28
|
+
if so.exitstatus == 0
|
29
|
+
nodejs = Mash.new
|
30
|
+
output = so.stdout.split
|
31
|
+
if output.length >= 1
|
32
|
+
nodejs[:version] = output[0][1..output[0].length]
|
35
33
|
end
|
36
|
-
|
37
|
-
logger.trace('Plugin Nodejs: Could not shell_out "node -v". Skipping plugin')
|
34
|
+
languages[:nodejs] = nodejs if nodejs[:version]
|
38
35
|
end
|
36
|
+
rescue Ohai::Exceptions::Exec
|
37
|
+
logger.trace('Plugin Nodejs: Could not shell_out "node -v". Skipping plugin')
|
38
|
+
|
39
39
|
end
|
40
40
|
end
|
@@ -69,7 +69,7 @@ Ohai.plugin(:Openstack) do
|
|
69
69
|
# fetch the metadata if we can do a simple socket connect first
|
70
70
|
if can_socket_connect?(Ohai::Mixin::Ec2Metadata::EC2_METADATA_ADDR, 80, timeout)
|
71
71
|
fetch_metadata.each do |k, v|
|
72
|
-
openstack[k] = v
|
72
|
+
openstack[k] = v unless v.empty?
|
73
73
|
end
|
74
74
|
logger.trace("Plugin Openstack: Successfully fetched Openstack metadata from the metadata endpoint")
|
75
75
|
else
|
@@ -50,34 +50,7 @@ Ohai.plugin(:Packages) do
|
|
50
50
|
|
51
51
|
pkgs.each do |pkg|
|
52
52
|
name, epoch, version, release, installdate, arch = pkg.split
|
53
|
-
|
54
|
-
# We have more than one package with this exact name!
|
55
|
-
# Create an "versions" array for tracking all versions of packages with this name.
|
56
|
-
# The top-level package information will be the first one returned by rpm -qa,
|
57
|
-
# all versions go in this list, with the same information they'd normally have.
|
58
|
-
if packages[name]["versions"].nil?
|
59
|
-
# add the data of the first package to the list, so that all versions are in the list.
|
60
|
-
packages[name]["versions"] = []
|
61
|
-
packages[name]["versions"] << Mash.new({ "epoch" => packages[name]["epoch"],
|
62
|
-
"version" => packages[name]["version"],
|
63
|
-
"release" => packages[name]["release"],
|
64
|
-
"installdate" => packages[name]["installdate"],
|
65
|
-
"arch" => packages[name]["arch"] })
|
66
|
-
end
|
67
|
-
packages[name]["versions"] << Mash.new({ "epoch" => epoch, "version" => version, "release" => release, "installdate" => installdate, "arch" => arch }) # Add this package version to the list
|
68
|
-
# When this was originally written, it didn't account for multiple versions of the same package
|
69
|
-
# so it just kept clobbering the package data if it encountered multiple versions
|
70
|
-
# of the same package. As a result, the last duplicate returned by rpm -qa was what was present;
|
71
|
-
# here we clobber that data for compatibility. Note that we can't overwrite the entire hash
|
72
|
-
# without losing the versions array.
|
73
|
-
packages[name]["epoch"] = epoch
|
74
|
-
packages[name]["version"] = version
|
75
|
-
packages[name]["release"] = release
|
76
|
-
packages[name]["installdate"] = installdate
|
77
|
-
packages[name]["arch"] = arch
|
78
|
-
else
|
79
|
-
packages[name] = { "epoch" => epoch, "version" => version, "release" => release, "installdate" => installdate, "arch" => arch }
|
80
|
-
end
|
53
|
+
packages[name] = { "epoch" => epoch, "version" => version, "release" => release, "installdate" => installdate, "arch" => arch }
|
81
54
|
end
|
82
55
|
|
83
56
|
when "arch"
|
data/lib/ohai/plugins/perl.rb
CHANGED
@@ -21,25 +21,25 @@ Ohai.plugin(:Perl) do
|
|
21
21
|
depends "languages"
|
22
22
|
|
23
23
|
collect_data do
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
24
|
+
|
25
|
+
so = shell_out("perl -V:version -V:archname")
|
26
|
+
# Sample output:
|
27
|
+
# version='5.18.2';
|
28
|
+
# archname='darwin-thread-multi-2level';
|
29
|
+
if so.exitstatus == 0
|
30
|
+
perl = Mash.new
|
31
|
+
so.stdout.split(/\r?\n/).each do |line|
|
32
|
+
case line
|
33
|
+
when /^version=\'(.+)\';$/
|
34
|
+
perl[:version] = $1
|
35
|
+
when /^archname=\'(.+)\';$/
|
36
|
+
perl[:archname] = $1
|
38
37
|
end
|
39
|
-
languages[:perl] = perl unless perl.empty?
|
40
38
|
end
|
41
|
-
|
42
|
-
logger.trace('Plugin Perl: Could not shell_out "perl -V:version -V:archname". Skipping plugin')
|
39
|
+
languages[:perl] = perl unless perl.empty?
|
43
40
|
end
|
41
|
+
rescue Ohai::Exceptions::Exec
|
42
|
+
logger.trace('Plugin Perl: Could not shell_out "perl -V:version -V:archname". Skipping plugin')
|
43
|
+
|
44
44
|
end
|
45
45
|
end
|
data/lib/ohai/plugins/php.rb
CHANGED
@@ -23,30 +23,30 @@ Ohai.plugin(:PHP) do
|
|
23
23
|
depends "languages"
|
24
24
|
|
25
25
|
collect_data do
|
26
|
-
begin
|
27
|
-
so = shell_out("php -v")
|
28
|
-
# Sample output:
|
29
|
-
# PHP 5.5.31 (cli) (built: Feb 20 2016 20:33:10)
|
30
|
-
# Copyright (c) 1997-2015 The PHP Group
|
31
|
-
# Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
|
32
|
-
if so.exitstatus == 0
|
33
|
-
php = Mash.new
|
34
|
-
so.stdout.each_line do |line|
|
35
|
-
case line
|
36
|
-
when /^PHP (\S+)(?:.*built: ([^)]+))?/
|
37
|
-
php[:version] = $1
|
38
|
-
php[:builddate] = $2
|
39
|
-
when /Zend Engine v([^\s]+),/
|
40
|
-
php[:zend_engine_version] = $1
|
41
|
-
when /Zend OPcache v([^\s]+),/
|
42
|
-
php[:zend_opcache_version] = $1
|
43
|
-
end
|
44
|
-
end
|
45
26
|
|
46
|
-
|
27
|
+
so = shell_out("php -v")
|
28
|
+
# Sample output:
|
29
|
+
# PHP 5.5.31 (cli) (built: Feb 20 2016 20:33:10)
|
30
|
+
# Copyright (c) 1997-2015 The PHP Group
|
31
|
+
# Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
|
32
|
+
if so.exitstatus == 0
|
33
|
+
php = Mash.new
|
34
|
+
so.stdout.each_line do |line|
|
35
|
+
case line
|
36
|
+
when /^PHP (\S+)(?:.*built: ([^)]+))?/
|
37
|
+
php[:version] = $1
|
38
|
+
php[:builddate] = $2
|
39
|
+
when /Zend Engine v([^\s]+),/
|
40
|
+
php[:zend_engine_version] = $1
|
41
|
+
when /Zend OPcache v([^\s]+),/
|
42
|
+
php[:zend_opcache_version] = $1
|
43
|
+
end
|
47
44
|
end
|
48
|
-
|
49
|
-
|
45
|
+
|
46
|
+
languages[:php] = php unless php.empty?
|
50
47
|
end
|
48
|
+
rescue Ohai::Exceptions::Exec
|
49
|
+
logger.trace('Plugin Php: Could not shell_out "php -v". Skipping plugin')
|
50
|
+
|
51
51
|
end
|
52
52
|
end
|
@@ -20,39 +20,39 @@ Ohai.plugin(:Powershell) do
|
|
20
20
|
depends "languages"
|
21
21
|
|
22
22
|
collect_data(:windows) do
|
23
|
-
begin
|
24
|
-
so = shell_out("powershell.exe -NoLogo -NonInteractive -NoProfile -command $PSVersionTable")
|
25
|
-
# Sample output:
|
26
|
-
#
|
27
|
-
# Name Value
|
28
|
-
# ---- -----
|
29
|
-
# PSVersion 4.0
|
30
|
-
# WSManStackVersion 3.0
|
31
|
-
# SerializationVersion 1.1.0.1
|
32
|
-
# CLRVersion 4.0.30319.34014
|
33
|
-
# BuildVersion 6.3.9600.16394
|
34
|
-
# PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
|
35
|
-
# PSRemotingProtocolVersion 2.2
|
36
23
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
24
|
+
so = shell_out("powershell.exe -NoLogo -NonInteractive -NoProfile -command $PSVersionTable")
|
25
|
+
# Sample output:
|
26
|
+
#
|
27
|
+
# Name Value
|
28
|
+
# ---- -----
|
29
|
+
# PSVersion 4.0
|
30
|
+
# WSManStackVersion 3.0
|
31
|
+
# SerializationVersion 1.1.0.1
|
32
|
+
# CLRVersion 4.0.30319.34014
|
33
|
+
# BuildVersion 6.3.9600.16394
|
34
|
+
# PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
|
35
|
+
# PSRemotingProtocolVersion 2.2
|
36
|
+
|
37
|
+
if so.exitstatus == 0
|
38
|
+
powershell = Mash.new
|
39
|
+
version_info = {}
|
40
|
+
so.stdout.strip.each_line do |line|
|
41
|
+
kv = line.strip.split(/\s+/, 2)
|
42
|
+
version_info[kv[0]] = kv[1] if kv.length == 2
|
52
43
|
end
|
53
|
-
|
54
|
-
|
44
|
+
powershell[:version] = version_info["PSVersion"]
|
45
|
+
powershell[:ws_man_stack_version] = version_info["WSManStackVersion"]
|
46
|
+
powershell[:serialization_version] = version_info["SerializationVersion"]
|
47
|
+
powershell[:clr_version] = version_info["CLRVersion"]
|
48
|
+
powershell[:build_version] = version_info["BuildVersion"]
|
49
|
+
powershell[:compatible_versions] = parse_compatible_versions
|
50
|
+
powershell[:remoting_protocol_version] = version_info["PSRemotingProtocolVersion"]
|
51
|
+
languages[:powershell] = powershell unless powershell.empty?
|
55
52
|
end
|
53
|
+
rescue Ohai::Exceptions::Exec
|
54
|
+
logger.trace('Plugin Powershell: Could not shell_out "powershell.exe -NoLogo -NonInteractive -NoProfile -command $PSVersionTable". Skipping plugin')
|
55
|
+
|
56
56
|
end
|
57
57
|
|
58
58
|
def version_command
|
data/lib/ohai/plugins/ps.rb
CHANGED
data/lib/ohai/plugins/python.rb
CHANGED
@@ -22,22 +22,22 @@ Ohai.plugin(:Python) do
|
|
22
22
|
depends "languages"
|
23
23
|
|
24
24
|
collect_data do
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
end
|
37
|
-
languages[:python] = python unless python.empty?
|
25
|
+
|
26
|
+
so = shell_out("python -c \"import sys; print (sys.version)\"")
|
27
|
+
# Sample output:
|
28
|
+
# 2.7.11 (default, Dec 26 2015, 17:47:53)
|
29
|
+
# [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
|
30
|
+
if so.exitstatus == 0
|
31
|
+
python = Mash.new
|
32
|
+
output = so.stdout.split
|
33
|
+
python[:version] = output[0]
|
34
|
+
if output.length >= 6
|
35
|
+
python[:builddate] = "%s %s %s %s" % [output[2], output[3], output[4], output[5].delete!(")")]
|
38
36
|
end
|
39
|
-
|
40
|
-
logger.trace('Plugin Python: Could not shell_out "python -c "import sys; print (sys.version)"". Skipping plugin')
|
37
|
+
languages[:python] = python unless python.empty?
|
41
38
|
end
|
39
|
+
rescue Ohai::Exceptions::Exec
|
40
|
+
logger.trace('Plugin Python: Could not shell_out "python -c "import sys; print (sys.version)"". Skipping plugin')
|
41
|
+
|
42
42
|
end
|
43
43
|
end
|
data/lib/ohai/plugins/rust.rb
CHANGED
@@ -18,17 +18,17 @@ Ohai.plugin(:Rust) do
|
|
18
18
|
depends "languages"
|
19
19
|
|
20
20
|
collect_data do
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
rescue Ohai::Exceptions::Exec
|
31
|
-
logger.trace('Plugin Rust: Could not shell_out "rustc --version". Skipping plugin')
|
21
|
+
|
22
|
+
so = shell_out("rustc --version")
|
23
|
+
# Sample output:
|
24
|
+
# rustc 1.7.0
|
25
|
+
if so.exitstatus == 0
|
26
|
+
rust = Mash.new
|
27
|
+
rust[:version] = so.stdout.split[1]
|
28
|
+
languages[:rust] = rust if rust[:version]
|
32
29
|
end
|
30
|
+
rescue Ohai::Exceptions::Exec
|
31
|
+
logger.trace('Plugin Rust: Could not shell_out "rustc --version". Skipping plugin')
|
32
|
+
|
33
33
|
end
|
34
34
|
end
|