ohai 16.2.1 → 16.4.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/bin/ohai +0 -2
- data/lib/ohai/application.rb +2 -2
- data/lib/ohai/dsl/plugin.rb +1 -1
- data/lib/ohai/loader.rb +1 -2
- data/lib/ohai/log.rb +1 -1
- data/lib/ohai/mixin/command.rb +1 -1
- data/lib/ohai/mixin/dmi_decode.rb +2 -2
- data/lib/ohai/mixin/os.rb +1 -1
- data/lib/ohai/mixin/softlayer_metadata.rb +1 -1
- data/lib/ohai/plugins/aix/memory.rb +3 -3
- data/lib/ohai/plugins/aix/network.rb +2 -1
- data/lib/ohai/plugins/aix/uptime.rb +2 -2
- data/lib/ohai/plugins/aix/virtualization.rb +5 -5
- data/lib/ohai/plugins/azure.rb +1 -1
- data/lib/ohai/plugins/bsd/virtualization.rb +2 -2
- data/lib/ohai/plugins/c.rb +2 -2
- data/lib/ohai/plugins/cloud.rb +1 -1
- data/lib/ohai/plugins/cpu.rb +2 -2
- data/lib/ohai/plugins/darwin/network.rb +3 -3
- data/lib/ohai/plugins/darwin/virtualization.rb +1 -1
- data/lib/ohai/plugins/docker.rb +2 -2
- data/lib/ohai/plugins/dragonflybsd/platform.rb +2 -4
- data/lib/ohai/plugins/ec2.rb +8 -7
- data/lib/ohai/plugins/eucalyptus.rb +1 -1
- data/lib/ohai/plugins/filesystem.rb +11 -17
- data/lib/ohai/plugins/fips.rb +1 -5
- data/lib/ohai/plugins/freebsd/platform.rb +2 -4
- data/lib/ohai/plugins/gce.rb +3 -3
- data/lib/ohai/plugins/hostname.rb +16 -16
- data/lib/ohai/plugins/kernel.rb +1 -1
- data/lib/ohai/plugins/linux/hostnamectl.rb +1 -2
- data/lib/ohai/plugins/linux/interrupts.rb +1 -1
- data/lib/ohai/plugins/linux/lsb.rb +1 -2
- data/lib/ohai/plugins/linux/lspci.rb +1 -2
- data/lib/ohai/plugins/linux/machineid.rb +2 -2
- data/lib/ohai/plugins/linux/mdadm.rb +1 -1
- data/lib/ohai/plugins/linux/network.rb +19 -9
- data/lib/ohai/plugins/linux/platform.rb +22 -25
- data/lib/ohai/plugins/linux/virtualization.rb +12 -9
- data/lib/ohai/plugins/netbsd/network.rb +4 -8
- data/lib/ohai/plugins/netbsd/platform.rb +2 -4
- data/lib/ohai/plugins/network.rb +5 -4
- data/lib/ohai/plugins/openbsd/network.rb +4 -8
- data/lib/ohai/plugins/openbsd/platform.rb +2 -4
- data/lib/ohai/plugins/openstack.rb +3 -2
- data/lib/ohai/plugins/packages.rb +1 -1
- data/lib/ohai/plugins/passwd.rb +2 -1
- data/lib/ohai/plugins/rackspace.rb +5 -4
- data/lib/ohai/plugins/root_group.rb +1 -1
- data/lib/ohai/plugins/ruby.rb +4 -15
- data/lib/ohai/plugins/scaleway.rb +1 -1
- data/lib/ohai/plugins/shard.rb +1 -1
- data/lib/ohai/plugins/solaris2/dmi.rb +2 -3
- data/lib/ohai/plugins/solaris2/memory.rb +1 -2
- data/lib/ohai/plugins/solaris2/network.rb +2 -6
- data/lib/ohai/plugins/solaris2/platform.rb +1 -2
- data/lib/ohai/plugins/solaris2/virtualization.rb +3 -6
- data/lib/ohai/plugins/ssh_host_key.rb +1 -1
- data/lib/ohai/plugins/uptime.rb +1 -1
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/dmi.rb +2 -2
- data/lib/ohai/plugins/windows/drivers.rb +1 -1
- data/lib/ohai/plugins/windows/memory.rb +1 -1
- data/lib/ohai/plugins/windows/network.rb +4 -4
- data/lib/ohai/plugins/windows/platform.rb +1 -1
- data/lib/ohai/plugins/windows/virtualization.rb +1 -1
- data/lib/ohai/provides_map.rb +2 -2
- data/lib/ohai/runner.rb +1 -1
- data/lib/ohai/util/ip_helper.rb +2 -2
- data/lib/ohai/util/win32.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a41b8cc8fc0d00fb8816f241f080d183be4b5b4019be40a6e6ab5603d4ab5c5
|
4
|
+
data.tar.gz: adc92d0dcb0c5a5490aa842cd513c761fe984dc6a4aeb5cafdbc7cc8f705d61f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd143425b3e1bcd9ef730496e890f41107f9676185bede8b8a8ce2a26cb4f007326d9023121396526c85426f9d07de36a7a5d448e76ad3efe1dcbb0c6fffa186
|
7
|
+
data.tar.gz: 2b93a5ed54f74514be768879bbac6b068c697b09d735258d7716800c2367bad16522b9124a202b9824eb627b45021ab8404ae803f43109a3e5531aec35518f58
|
data/Gemfile
CHANGED
@@ -5,6 +5,7 @@ gemspec
|
|
5
5
|
# NOTE: do not submit PRs to add pry as a dep, add to your Gemfile.local
|
6
6
|
group :development do
|
7
7
|
gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
|
8
|
+
gem "rubocop-performance", "1.7.1"
|
8
9
|
gem "rake", ">= 10.1.0"
|
9
10
|
gem "rspec-core", "~> 3.0"
|
10
11
|
gem "rspec-expectations", "~> 3.0"
|
@@ -24,4 +25,4 @@ group :debug do
|
|
24
25
|
gem "pry-byebug"
|
25
26
|
gem "pry-stack_explorer", "~> 0.4.0" # pin until we drop ruby < 2.6
|
26
27
|
gem "rb-readline"
|
27
|
-
end
|
28
|
+
end
|
data/bin/ohai
CHANGED
data/lib/ohai/application.rb
CHANGED
@@ -18,9 +18,9 @@
|
|
18
18
|
require "chef-config/path_helper"
|
19
19
|
require "chef-config/workstation_config_loader"
|
20
20
|
require_relative "../ohai"
|
21
|
-
require_relative "log"
|
21
|
+
require_relative "log" unless defined?(Ohai::Log)
|
22
22
|
require "mixlib/cli" unless defined?(Mixlib::CLI)
|
23
|
-
require "benchmark"
|
23
|
+
require "benchmark" unless defined?(Benchmark)
|
24
24
|
|
25
25
|
# The Application class is what is called by the Ohai CLI binary. It handles:
|
26
26
|
# - CLI options and attribute arguments
|
data/lib/ohai/dsl/plugin.rb
CHANGED
data/lib/ohai/loader.rb
CHANGED
@@ -71,8 +71,7 @@ module Ohai
|
|
71
71
|
from = [ Ohai.config[:plugin_path], from].flatten
|
72
72
|
plugin_files_by_dir(from).collect do |plugin_file|
|
73
73
|
logger.trace "Loading additional plugin: #{plugin_file}"
|
74
|
-
|
75
|
-
load_v7_plugin(plugin)
|
74
|
+
load_v7_plugin(load_plugin_class(plugin_file))
|
76
75
|
end
|
77
76
|
end
|
78
77
|
|
data/lib/ohai/log.rb
CHANGED
data/lib/ohai/mixin/command.rb
CHANGED
@@ -30,7 +30,7 @@ module Ohai
|
|
30
30
|
options = options.dup
|
31
31
|
# unless specified by the caller timeout after configured timeout (default 30 seconds)
|
32
32
|
options[:timeout] ||= Ohai::Config.ohai[:shellout_timeout]
|
33
|
-
unless RUBY_PLATFORM
|
33
|
+
unless RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
34
34
|
options[:env] = options.key?(:env) ? options[:env].dup : {}
|
35
35
|
options[:env]["PATH"] ||= ((ENV["PATH"] || "").split(":") + %w{/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin}).join(":")
|
36
36
|
end
|
@@ -26,7 +26,7 @@ module ::Ohai::Mixin::DmiDecode
|
|
26
26
|
when /VMware/
|
27
27
|
return "vmware"
|
28
28
|
when /Microsoft/
|
29
|
-
return "hyperv" if
|
29
|
+
return "hyperv" if /Virtual Machine/.match?(product)
|
30
30
|
when /Amazon EC2/
|
31
31
|
return "amazonec2"
|
32
32
|
when /QEMU/
|
@@ -40,7 +40,7 @@ module ::Ohai::Mixin::DmiDecode
|
|
40
40
|
case product
|
41
41
|
when /VirtualBox/
|
42
42
|
return "vbox"
|
43
|
-
when /OpenStack/ # yes this is here twice. Product catches
|
43
|
+
when /OpenStack/ # yes this is here twice. Product catches Red Hat's version
|
44
44
|
return "openstack"
|
45
45
|
when /(KVM|RHEV)/
|
46
46
|
return "kvm"
|
data/lib/ohai/mixin/os.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
# See the License for the specific language governing permissions and
|
18
18
|
# limitations under the License.
|
19
19
|
|
20
|
-
require "net/
|
20
|
+
require "net/http" unless defined?(Net::HTTP)
|
21
21
|
require "uri" unless defined?(URI)
|
22
22
|
|
23
23
|
# https://softlayer.github.io/reference/services/SoftLayer_Resource_Metadata/
|
@@ -29,8 +29,8 @@ Ohai.plugin(:Memory) do
|
|
29
29
|
memory[:total] = "#{total_in_mb.to_i * 1024}kB"
|
30
30
|
memory[:free] = "#{free_in_mb.to_i * 1024}kB"
|
31
31
|
|
32
|
-
|
33
|
-
memory[:swap]["total"] = "#{(
|
34
|
-
memory[:swap]["free"] = "#{(
|
32
|
+
swap_info = shell_out("swap -s").stdout.split # returns swap info in 4K blocks
|
33
|
+
memory[:swap]["total"] = "#{(swap_info[2].to_i) * 4}kB"
|
34
|
+
memory[:swap]["free"] = "#{(swap_info[10].to_i) * 4}kB"
|
35
35
|
end
|
36
36
|
end
|
@@ -19,7 +19,6 @@
|
|
19
19
|
#
|
20
20
|
|
21
21
|
Ohai.plugin(:Network) do
|
22
|
-
require "ipaddr"
|
23
22
|
require_relative "../../mixin/network_helper"
|
24
23
|
|
25
24
|
provides "network", "counters/network", "macaddress"
|
@@ -27,6 +26,8 @@ Ohai.plugin(:Network) do
|
|
27
26
|
include Ohai::Mixin::NetworkHelper
|
28
27
|
|
29
28
|
collect_data(:aix) do
|
29
|
+
require "ipaddr" unless defined?(IPAddr)
|
30
|
+
|
30
31
|
# Loads following information.
|
31
32
|
# :default_interface, :default_gateway - route -n get 0
|
32
33
|
# :interfaces
|
@@ -21,7 +21,7 @@ Ohai.plugin(:Uptime) do
|
|
21
21
|
provides "uptime", "uptime_seconds"
|
22
22
|
|
23
23
|
collect_data(:aix) do
|
24
|
-
require "date"
|
24
|
+
require "date" unless defined?(DateTime)
|
25
25
|
# below we're going to assume that PID 1 is init (this is true 99.99999% of the time)
|
26
26
|
# output will look like this
|
27
27
|
# 1148-20:54:50
|
@@ -30,7 +30,7 @@ Ohai.plugin(:Uptime) do
|
|
30
30
|
so = shell_out("LC_ALL=POSIX ps -o etime= -p 1").stdout.strip
|
31
31
|
|
32
32
|
# Here we'll check our shell_out for a dash, which indicates there is a # of days involved
|
33
|
-
# We'll chunk off the days, hours (where applicable), minutes, seconds into
|
33
|
+
# We'll chunk off the days, hours (where applicable), minutes, seconds into separate vars
|
34
34
|
# We also need to do this because ps -o etime= will not display days if the machine has been up for less than 24 hours
|
35
35
|
# If the machine has been up for less than one hour, the shell_out will not output hours hence our else
|
36
36
|
# see here: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_72/com.ibm.aix.cmds4/ps.htm#ps__row-d3e109655
|
@@ -57,7 +57,7 @@ Ohai.plugin(:Virtualization) do
|
|
57
57
|
sections.each do |line|
|
58
58
|
case title
|
59
59
|
when "network"
|
60
|
-
next if
|
60
|
+
next if /^Interface|^---/.match?(line)
|
61
61
|
|
62
62
|
splat = line.strip.split
|
63
63
|
key = splat[0].downcase
|
@@ -68,7 +68,7 @@ Ohai.plugin(:Virtualization) do
|
|
68
68
|
}
|
69
69
|
wpars[wpar_name][title][key] = value
|
70
70
|
when "user-specified routes"
|
71
|
-
next if
|
71
|
+
next if /^Type|^---/.match?(line)
|
72
72
|
|
73
73
|
splat = line.strip.split
|
74
74
|
key = splat[2].downcase
|
@@ -78,7 +78,7 @@ Ohai.plugin(:Virtualization) do
|
|
78
78
|
}
|
79
79
|
wpars[wpar_name][title][key] = value
|
80
80
|
when "file systems"
|
81
|
-
next if
|
81
|
+
next if /^MountPoint|^---/.match?(line)
|
82
82
|
|
83
83
|
splat = line.strip.split
|
84
84
|
key = splat[1].downcase
|
@@ -93,7 +93,7 @@ Ohai.plugin(:Virtualization) do
|
|
93
93
|
privileges ||= ""
|
94
94
|
wpars[wpar_name][title]["Privileges"] ||= []
|
95
95
|
|
96
|
-
if
|
96
|
+
if /^Privileges/.match?(line)
|
97
97
|
privileges << line.split(":")[1].strip
|
98
98
|
else
|
99
99
|
privileges << line.strip
|
@@ -101,7 +101,7 @@ Ohai.plugin(:Virtualization) do
|
|
101
101
|
|
102
102
|
wpars[wpar_name][title]["Privileges"] += privileges.split(",")
|
103
103
|
when "device exports"
|
104
|
-
next if
|
104
|
+
next if /^Name|^---/.match?(line)
|
105
105
|
|
106
106
|
splat = line.strip.split
|
107
107
|
key = splat[0].downcase
|
data/lib/ohai/plugins/azure.rb
CHANGED
@@ -57,7 +57,7 @@ Ohai.plugin(:Azure) do
|
|
57
57
|
has_245 = false
|
58
58
|
if File.exist?("/var/lib/dhcp/dhclient.eth0.leases")
|
59
59
|
File.open("/var/lib/dhcp/dhclient.eth0.leases").each do |line|
|
60
|
-
if
|
60
|
+
if /unknown-245/.match?(line)
|
61
61
|
logger.trace("Plugin Azure: Found unknown-245 DHCP option used by Azure.")
|
62
62
|
has_245 = true
|
63
63
|
break
|
@@ -76,7 +76,7 @@ Ohai.plugin(:Virtualization) do
|
|
76
76
|
# Detect KVM/QEMU paravirt guests from cpu, report as KVM
|
77
77
|
# hw.model: QEMU Virtual CPU version 0.9.1
|
78
78
|
so = shell_out("sysctl -n hw.model")
|
79
|
-
if
|
79
|
+
if /QEMU Virtual CPU|KVM processor/.match?(so.stdout)
|
80
80
|
virtualization[:system] = "kvm"
|
81
81
|
virtualization[:role] = "guest"
|
82
82
|
virtualization[:systems][:kvm] = "guest"
|
@@ -96,7 +96,7 @@ Ohai.plugin(:Virtualization) do
|
|
96
96
|
"xen"
|
97
97
|
when /kvm/
|
98
98
|
so = shell_out("sysctl -n kern.hostuuid")
|
99
|
-
so.stdout
|
99
|
+
/^ec2/.match?(so.stdout) ? "amazonec2" : "kvm"
|
100
100
|
when /bhyve/
|
101
101
|
"bhyve"
|
102
102
|
end
|
data/lib/ohai/plugins/c.rb
CHANGED
@@ -137,7 +137,7 @@ Ohai.plugin(:C) do
|
|
137
137
|
logger.trace("Plugin C: 'xlc' binary could not be found. Skipping data.")
|
138
138
|
end
|
139
139
|
|
140
|
-
def
|
140
|
+
def collect_sun_pro
|
141
141
|
# sun pro
|
142
142
|
collect("cc -V -flags") do |so|
|
143
143
|
output = so.stderr.split
|
@@ -173,7 +173,7 @@ Ohai.plugin(:C) do
|
|
173
173
|
@c = Mash.new
|
174
174
|
collect_gcc
|
175
175
|
collect_glibc
|
176
|
-
|
176
|
+
collect_sun_pro
|
177
177
|
languages[:c] = @c unless @c.empty?
|
178
178
|
end
|
179
179
|
end
|
data/lib/ohai/plugins/cloud.rb
CHANGED
data/lib/ohai/plugins/cpu.rb
CHANGED
@@ -305,7 +305,7 @@ Ohai.plugin(:CPU) do
|
|
305
305
|
cpu[index] = Mash.new
|
306
306
|
cpu[index][:status] = status
|
307
307
|
cpu[index][:location] = location
|
308
|
-
if
|
308
|
+
if /Available/.match?(status)
|
309
309
|
cpu[:available] += 1
|
310
310
|
lsattr = shell_out("lsattr -El #{name}").stdout.lines
|
311
311
|
lsattr.each do |attribute|
|
@@ -377,7 +377,7 @@ Ohai.plugin(:CPU) do
|
|
377
377
|
end
|
378
378
|
|
379
379
|
collect_data(:windows) do
|
380
|
-
require "wmi-lite/wmi"
|
380
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
381
381
|
|
382
382
|
cpu Mash.new
|
383
383
|
cores = 0
|
@@ -66,8 +66,8 @@ Ohai.plugin(:Network) do
|
|
66
66
|
|
67
67
|
def scope_lookup(scope)
|
68
68
|
return "Node" if scope.eql?("::1")
|
69
|
-
return "Link" if
|
70
|
-
return "Site" if
|
69
|
+
return "Link" if /^fe80\:/.match?(scope)
|
70
|
+
return "Site" if /^fec0\:/.match?(scope)
|
71
71
|
|
72
72
|
"Global"
|
73
73
|
end
|
@@ -79,7 +79,7 @@ Ohai.plugin(:Network) do
|
|
79
79
|
def locate_interface(ifaces, ifname, mac)
|
80
80
|
return ifname unless ifaces[ifname].nil?
|
81
81
|
# oh well, time to go hunting!
|
82
|
-
return ifname.chop if ifname
|
82
|
+
return ifname.chop if /\*$/.match?(ifname)
|
83
83
|
|
84
84
|
ifaces.each_key do |ifc|
|
85
85
|
ifaces[ifc][:addresses].each_key do |addr|
|
@@ -82,7 +82,7 @@ Ohai.plugin(:Virtualization) do
|
|
82
82
|
virtualization[:systems][:parallels] = "host"
|
83
83
|
elsif ioreg_exists?
|
84
84
|
so = shell_out("ioreg -l")
|
85
|
-
if
|
85
|
+
if /pci1ab8,4000/.match?(so.stdout)
|
86
86
|
virtualization[:system] = "parallels"
|
87
87
|
virtualization[:role] = "guest"
|
88
88
|
virtualization[:systems][:parallels] = "guest"
|
data/lib/ohai/plugins/docker.rb
CHANGED
@@ -16,8 +16,6 @@
|
|
16
16
|
#
|
17
17
|
|
18
18
|
Ohai.plugin(:Docker) do
|
19
|
-
require "json"
|
20
|
-
|
21
19
|
provides "docker"
|
22
20
|
depends "virtualization"
|
23
21
|
|
@@ -50,6 +48,8 @@ Ohai.plugin(:Docker) do
|
|
50
48
|
end
|
51
49
|
|
52
50
|
collect_data do
|
51
|
+
require "json" unless defined?(JSON)
|
52
|
+
|
53
53
|
if virtualization[:systems][:docker]
|
54
54
|
docker_ohai_data(docker_info_json)
|
55
55
|
end
|
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
21
21
|
|
22
22
|
collect_data(:dragonflybsd) do
|
23
|
-
|
24
|
-
|
25
|
-
so = shell_out("uname -r")
|
26
|
-
platform_version so.stdout.split($/)[0]
|
23
|
+
platform shell_out("uname -s").stdout.split($/)[0].downcase
|
24
|
+
platform_version shell_out("uname -r").stdout.split($/)[0]
|
27
25
|
platform_family "dragonflybsd"
|
28
26
|
end
|
29
27
|
end
|
data/lib/ohai/plugins/ec2.rb
CHANGED
@@ -28,7 +28,6 @@
|
|
28
28
|
Ohai.plugin(:EC2) do
|
29
29
|
require_relative "../mixin/ec2_metadata"
|
30
30
|
require_relative "../mixin/http_helper"
|
31
|
-
require "base64"
|
32
31
|
|
33
32
|
include Ohai::Mixin::Ec2Metadata
|
34
33
|
include Ohai::Mixin::HttpHelper
|
@@ -41,7 +40,7 @@ Ohai.plugin(:EC2) do
|
|
41
40
|
# @return [Boolean] do we have Amazon DMI data?
|
42
41
|
def has_ec2_amazon_dmi?
|
43
42
|
# detect a version of '4.2.amazon'
|
44
|
-
if file_val_if_exists("/sys/class/dmi/id/bios_vendor")
|
43
|
+
if /Amazon/.match?(file_val_if_exists("/sys/class/dmi/id/bios_vendor"))
|
45
44
|
logger.trace("Plugin EC2: has_ec2_amazon_dmi? == true")
|
46
45
|
true
|
47
46
|
else
|
@@ -56,7 +55,7 @@ Ohai.plugin(:EC2) do
|
|
56
55
|
# @return [Boolean] do we have Amazon DMI data?
|
57
56
|
def has_ec2_xen_dmi?
|
58
57
|
# detect a version of '4.2.amazon'
|
59
|
-
if file_val_if_exists("/sys/class/dmi/id/bios_version")
|
58
|
+
if /amazon/.match?(file_val_if_exists("/sys/class/dmi/id/bios_version"))
|
60
59
|
logger.trace("Plugin EC2: has_ec2_xen_dmi? == true")
|
61
60
|
true
|
62
61
|
else
|
@@ -68,7 +67,7 @@ Ohai.plugin(:EC2) do
|
|
68
67
|
# looks for a xen UUID that starts with ec2 from within the Linux sys tree
|
69
68
|
# @return [Boolean] do we have a Xen UUID or not?
|
70
69
|
def has_ec2_xen_uuid?
|
71
|
-
if file_val_if_exists("/sys/hypervisor/uuid")
|
70
|
+
if /^ec2/.match?(file_val_if_exists("/sys/hypervisor/uuid"))
|
72
71
|
logger.trace("Plugin EC2: has_ec2_xen_uuid? == true")
|
73
72
|
return true
|
74
73
|
end
|
@@ -81,10 +80,10 @@ Ohai.plugin(:EC2) do
|
|
81
80
|
# linux hosts
|
82
81
|
# @return [Boolean] do we have a Xen Identifying Number or not?
|
83
82
|
def has_ec2_identifying_number?
|
84
|
-
if RUBY_PLATFORM
|
85
|
-
require "wmi-lite/wmi"
|
83
|
+
if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
84
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
86
85
|
wmi = WmiLite::Wmi.new
|
87
|
-
if wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"]
|
86
|
+
if /^ec2/.match?(wmi.first_of("Win32_ComputerSystemProduct")["identifyingnumber"])
|
88
87
|
logger.trace("Plugin EC2: has_ec2_identifying_number? == true")
|
89
88
|
true
|
90
89
|
end
|
@@ -115,6 +114,8 @@ Ohai.plugin(:EC2) do
|
|
115
114
|
end
|
116
115
|
|
117
116
|
collect_data do
|
117
|
+
require "base64"
|
118
|
+
|
118
119
|
if looks_like_ec2?
|
119
120
|
logger.trace("Plugin EC2: looks_like_ec2? == true")
|
120
121
|
ec2 Mash.new
|
@@ -42,7 +42,7 @@ Ohai.plugin(:Eucalyptus) do
|
|
42
42
|
def has_euca_mac?
|
43
43
|
network[:interfaces].each_value do |iface|
|
44
44
|
mac = get_mac_address(iface[:addresses])
|
45
|
-
if
|
45
|
+
if /^[dD]0:0[dD]:/.match?(mac)
|
46
46
|
logger.trace("Plugin Eucalyptus: has_euca_mac? == true (#{mac})")
|
47
47
|
return true
|
48
48
|
end
|
@@ -23,8 +23,6 @@
|
|
23
23
|
# limitations under the License.
|
24
24
|
#
|
25
25
|
|
26
|
-
require "set"
|
27
|
-
|
28
26
|
Ohai.plugin(:Filesystem) do
|
29
27
|
provides "filesystem"
|
30
28
|
|
@@ -286,12 +284,10 @@ Ohai.plugin(:Filesystem) do
|
|
286
284
|
|
287
285
|
# Grab filesystem data from df
|
288
286
|
run_with_check("df") do
|
289
|
-
|
290
|
-
fs.merge!(parse_common_df(so.stdout))
|
287
|
+
fs.merge!(parse_common_df(shell_out("df -P").stdout))
|
291
288
|
|
292
289
|
# Grab filesystem inode data from df
|
293
|
-
|
294
|
-
so.stdout.each_line do |line|
|
290
|
+
shell_out("df -iP").stdout.each_line do |line|
|
295
291
|
case line
|
296
292
|
when /^Filesystem\s+Inodes/
|
297
293
|
next
|
@@ -310,8 +306,7 @@ Ohai.plugin(:Filesystem) do
|
|
310
306
|
|
311
307
|
# Grab mount information from /bin/mount
|
312
308
|
run_with_check("mount") do
|
313
|
-
|
314
|
-
so.stdout.each_line do |line|
|
309
|
+
shell_out("mount").stdout.each_line do |line|
|
315
310
|
if line =~ /^(.+?) on (.+?) type (.+?) \((.+?)\)$/
|
316
311
|
key = "#{$1},#{$2}"
|
317
312
|
fs[key] ||= Mash.new
|
@@ -346,8 +341,7 @@ Ohai.plugin(:Filesystem) do
|
|
346
341
|
# this is to allow machines with large amounts of attached LUNs
|
347
342
|
# to respond back to the command successfully
|
348
343
|
run_with_check(cmdtype) do
|
349
|
-
|
350
|
-
so.stdout.each_line do |line|
|
344
|
+
shell_out(cmd, timeout: 60).stdout.each_line do |line|
|
351
345
|
parsed = parse_line(line, cmdtype)
|
352
346
|
next if parsed.nil?
|
353
347
|
|
@@ -383,7 +377,6 @@ Ohai.plugin(:Filesystem) do
|
|
383
377
|
# we have to non-block read dev files. Ew.
|
384
378
|
f = File.open("/proc/mounts")
|
385
379
|
loop do
|
386
|
-
|
387
380
|
data = f.read_nonblock(4096)
|
388
381
|
mounts << data
|
389
382
|
# We should just catch EOFError, but the kernel had a period of
|
@@ -392,9 +385,9 @@ Ohai.plugin(:Filesystem) do
|
|
392
385
|
# whatever data we might have
|
393
386
|
rescue Exception
|
394
387
|
break
|
395
|
-
|
396
388
|
end
|
397
389
|
f.close
|
390
|
+
|
398
391
|
mounts.each_line do |line|
|
399
392
|
if line =~ /^(\S+) (\S+) (\S+) (\S+) \S+ \S+$/
|
400
393
|
key = "#{$1},#{$2}"
|
@@ -590,16 +583,16 @@ Ohai.plugin(:Filesystem) do
|
|
590
583
|
end
|
591
584
|
end
|
592
585
|
|
593
|
-
zfs.each do |
|
586
|
+
zfs.each do |fs_name, attributes|
|
594
587
|
mountpoint = attributes[:mountpoint][:value] if attributes[:mountpoint]
|
595
|
-
key = "#{
|
588
|
+
key = "#{fs_name},#{mountpoint}"
|
596
589
|
fs[key] ||= Mash.new
|
597
590
|
fs[key][:fs_type] = "zfs"
|
598
591
|
fs[key][:mount] = mountpoint if mountpoint
|
599
|
-
fs[key][:device] =
|
592
|
+
fs[key][:device] = fs_name
|
600
593
|
fs[key][:zfs_properties] = attributes
|
601
594
|
# find all zfs parents
|
602
|
-
parents =
|
595
|
+
parents = fs_name.split("/")
|
603
596
|
zfs_parents = []
|
604
597
|
(0..parents.length - 1).to_a.each do |parent_index|
|
605
598
|
next_parent = parents[0..parent_index].join("/")
|
@@ -718,7 +711,8 @@ Ohai.plugin(:Filesystem) do
|
|
718
711
|
end
|
719
712
|
|
720
713
|
collect_data(:windows) do
|
721
|
-
require "
|
714
|
+
require "set" unless defined?(Set)
|
715
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
722
716
|
require_relative "../mash"
|
723
717
|
|
724
718
|
fs = merge_info(logical_info, encryptable_info)
|