ohai 16.2.0 → 16.4.11
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/hardware.rb +2 -2
- data/lib/ohai/plugins/darwin/network.rb +3 -3
- data/lib/ohai/plugins/darwin/platform.rb +3 -6
- 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 +3 -3
- 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
@@ -59,7 +59,7 @@ Ohai.plugin(:Virtualization) do
|
|
59
59
|
|
60
60
|
# This file should exist on most Xen systems, normally empty for guests
|
61
61
|
if File.exist?("/proc/xen/capabilities")
|
62
|
-
if File.read("/proc/xen/capabilities")
|
62
|
+
if /control_d/i.match?(File.read("/proc/xen/capabilities"))
|
63
63
|
logger.trace("Plugin Virtualization: /proc/xen/capabilities contains control_d. Detecting as Xen host")
|
64
64
|
virtualization[:role] = "host"
|
65
65
|
virtualization[:systems][:xen] = "host"
|
@@ -70,12 +70,12 @@ Ohai.plugin(:Virtualization) do
|
|
70
70
|
# Detect Virtualbox from kernel module
|
71
71
|
if File.exist?("/proc/modules")
|
72
72
|
modules = File.read("/proc/modules")
|
73
|
-
if
|
73
|
+
if /^vboxdrv/.match?(modules)
|
74
74
|
logger.trace("Plugin Virtualization: /proc/modules contains vboxdrv. Detecting as vbox host")
|
75
75
|
virtualization[:system] = "vbox"
|
76
76
|
virtualization[:role] = "host"
|
77
77
|
virtualization[:systems][:vbox] = "host"
|
78
|
-
elsif
|
78
|
+
elsif /^vboxguest/.match?(modules)
|
79
79
|
logger.trace("Plugin Virtualization: /proc/modules contains vboxguest. Detecting as vbox guest")
|
80
80
|
virtualization[:system] = "vbox"
|
81
81
|
virtualization[:role] = "guest"
|
@@ -93,7 +93,7 @@ Ohai.plugin(:Virtualization) do
|
|
93
93
|
|
94
94
|
# Detect paravirt KVM/QEMU from cpuinfo, report as KVM
|
95
95
|
if File.exist?("/proc/cpuinfo")
|
96
|
-
if
|
96
|
+
if /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/.match?(File.read("/proc/cpuinfo"))
|
97
97
|
logger.trace("Plugin Virtualization: /proc/cpuinfo lists a KVM paravirt CPU string. Detecting as kvm guest")
|
98
98
|
virtualization[:system] = "kvm"
|
99
99
|
virtualization[:role] = "guest"
|
@@ -105,7 +105,7 @@ Ohai.plugin(:Virtualization) do
|
|
105
105
|
# guests will have the hypervisor cpu feature that hosts don't have
|
106
106
|
if File.exist?("/sys/devices/virtual/misc/kvm")
|
107
107
|
virtualization[:system] = "kvm"
|
108
|
-
if File.read("/proc/cpuinfo")
|
108
|
+
if /hypervisor/.match?(File.read("/proc/cpuinfo"))
|
109
109
|
logger.trace("Plugin Virtualization: /sys/devices/virtual/misc/kvm present and /proc/cpuinfo lists the hypervisor feature. Detecting as kvm guest")
|
110
110
|
virtualization[:role] = "guest"
|
111
111
|
virtualization[:systems][:kvm] = "guest"
|
@@ -190,18 +190,21 @@ Ohai.plugin(:Virtualization) do
|
|
190
190
|
# Kernel docs, https://www.kernel.org/doc/Documentation/cgroups
|
191
191
|
if File.exist?("/proc/self/cgroup")
|
192
192
|
cgroup_content = File.read("/proc/self/cgroup")
|
193
|
-
|
194
|
-
|
193
|
+
# These two REs catch many different examples. Here's a specific one
|
194
|
+
# from when it is docker and there is no subsystem name.
|
195
|
+
# https://rubular.com/r/dV13hiU9KxmiWB
|
196
|
+
if cgroup_content =~ %r{^\d+:[^:]*:/(lxc|docker)/.+$} ||
|
197
|
+
cgroup_content =~ %r{^\d+:[^:]*:/[^/]+/(lxc|docker)-?.+$}
|
195
198
|
logger.trace("Plugin Virtualization: /proc/self/cgroup indicates #{$1} container. Detecting as #{$1} guest")
|
196
199
|
virtualization[:system] = $1
|
197
200
|
virtualization[:role] = "guest"
|
198
201
|
virtualization[:systems][$1.to_sym] = "guest"
|
199
|
-
elsif File.read("/proc/1/environ")
|
202
|
+
elsif /container=lxc/.match?(File.read("/proc/1/environ"))
|
200
203
|
logger.trace("Plugin Virtualization: /proc/1/environ indicates lxc container. Detecting as lxc guest")
|
201
204
|
virtualization[:system] = "lxc"
|
202
205
|
virtualization[:role] = "guest"
|
203
206
|
virtualization[:systems][:lxc] = "guest"
|
204
|
-
elsif File.read("/proc/1/environ")
|
207
|
+
elsif /container=systemd-nspawn/.match?(File.read("/proc/1/environ"))
|
205
208
|
logger.trace("Plugin Virtualization: /proc/1/environ indicates nspawn container. Detecting as nspawn guest")
|
206
209
|
virtualization[:system] = "nspawn"
|
207
210
|
virtualization[:role] = "guest"
|
@@ -26,8 +26,7 @@ Ohai.plugin(:Network) do
|
|
26
26
|
counters Mash.new unless counters
|
27
27
|
counters[:network] ||= Mash.new
|
28
28
|
|
29
|
-
|
30
|
-
so.stdout.lines do |line|
|
29
|
+
shell_out("route -n get default").stdout.lines do |line|
|
31
30
|
if line =~ /(\w+): ([\w\.]+)/
|
32
31
|
case $1
|
33
32
|
when "gateway"
|
@@ -39,9 +38,8 @@ Ohai.plugin(:Network) do
|
|
39
38
|
end
|
40
39
|
|
41
40
|
iface = Mash.new
|
42
|
-
so = shell_out("#{Ohai.abs_path( "/sbin/ifconfig" )} -a")
|
43
41
|
cint = nil
|
44
|
-
|
42
|
+
shell_out("#{Ohai.abs_path( "/sbin/ifconfig" )} -a").stdout.lines do |line|
|
45
43
|
if line =~ /^([0-9a-zA-Z\.]+):\s+/
|
46
44
|
cint = $1
|
47
45
|
iface[cint] = Mash.new
|
@@ -85,8 +83,7 @@ Ohai.plugin(:Network) do
|
|
85
83
|
end
|
86
84
|
end
|
87
85
|
|
88
|
-
|
89
|
-
so.stdout.lines do |line|
|
86
|
+
shell_out("arp -an").stdout.lines do |line|
|
90
87
|
if line =~ /\((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) at ([a-fA-F0-9\:]+) on ([0-9a-zA-Z\.\:\-]+)/
|
91
88
|
next unless iface[$3] # this should never happen
|
92
89
|
|
@@ -102,8 +99,7 @@ Ohai.plugin(:Network) do
|
|
102
99
|
# Show the state of all network interfaces or a single interface
|
103
100
|
# which have been auto-configured (interfaces statically configured
|
104
101
|
# into a system, but not located at boot time are not shown).
|
105
|
-
|
106
|
-
so.stdout.lines do |line|
|
102
|
+
shell_out("netstat -idn").stdout.lines do |line|
|
107
103
|
# Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll Drop
|
108
104
|
# em0 1500 <Link> 00:11:25:2d:90:be 3719557 0 3369969 0 0 0
|
109
105
|
# $1 $2 $3 $4 $5 $6 $7 $8
|
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
21
21
|
|
22
22
|
collect_data(:netbsd) 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 "netbsd"
|
28
26
|
end
|
29
27
|
end
|
data/lib/ohai/plugins/network.rb
CHANGED
@@ -17,7 +17,6 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
Ohai.plugin(:NetworkAddresses) do
|
20
|
-
require "ipaddress"
|
21
20
|
require_relative "../mixin/network_helper"
|
22
21
|
include Ohai::Mixin::NetworkHelper
|
23
22
|
|
@@ -54,7 +53,7 @@ Ohai.plugin(:NetworkAddresses) do
|
|
54
53
|
ipaddresses.sort_by do |v|
|
55
54
|
[ ( scope_prio.index(v[:scope]) || 999999 ),
|
56
55
|
128 - v[:ipaddress].prefix.to_i,
|
57
|
-
|
56
|
+
v[:ipaddress].to_i,
|
58
57
|
]
|
59
58
|
end
|
60
59
|
end
|
@@ -88,9 +87,9 @@ Ohai.plugin(:NetworkAddresses) do
|
|
88
87
|
r = gw_if_ips.first
|
89
88
|
else
|
90
89
|
# checking network masks
|
91
|
-
r = gw_if_ips.
|
90
|
+
r = gw_if_ips.find do |v|
|
92
91
|
network_contains_address(network[gw_attr], v[:ipaddress], v[:iface])
|
93
|
-
end
|
92
|
+
end
|
94
93
|
if r.nil?
|
95
94
|
r = gw_if_ips.first
|
96
95
|
logger.trace("Plugin Network: [#{family}] no ipaddress/mask on #{network[int_attr]} matching the gateway #{network[gw_attr]}, picking #{r[:ipaddress]}")
|
@@ -134,6 +133,8 @@ Ohai.plugin(:NetworkAddresses) do
|
|
134
133
|
# time as ipaddress. if ipaddress is set and macaddress is nil, that means
|
135
134
|
# the interface ipaddress is bound to has the NOARP flag
|
136
135
|
collect_data do
|
136
|
+
require "ipaddress" unless defined?(IPAddress)
|
137
|
+
|
137
138
|
results = {}
|
138
139
|
|
139
140
|
network Mash.new unless network
|
@@ -26,8 +26,7 @@ Ohai.plugin(:Network) do
|
|
26
26
|
counters Mash.new unless counters
|
27
27
|
counters[:network] ||= Mash.new
|
28
28
|
|
29
|
-
|
30
|
-
so.stdout.lines do |line|
|
29
|
+
shell_out("route -n get default").stdout.lines do |line|
|
31
30
|
if line =~ /(\w+): ([\w\.]+)/
|
32
31
|
case $1
|
33
32
|
when "gateway"
|
@@ -39,9 +38,8 @@ Ohai.plugin(:Network) do
|
|
39
38
|
end
|
40
39
|
|
41
40
|
iface = Mash.new
|
42
|
-
so = shell_out( "#{Ohai.abs_path( "/sbin/ifconfig" )} -a" )
|
43
41
|
cint = nil
|
44
|
-
|
42
|
+
shell_out( "#{Ohai.abs_path( "/sbin/ifconfig" )} -a" ).stdout.lines do |line|
|
45
43
|
if line =~ /^([0-9a-zA-Z\.]+):\s+/
|
46
44
|
cint = $1
|
47
45
|
iface[cint] = Mash.new
|
@@ -85,8 +83,7 @@ Ohai.plugin(:Network) do
|
|
85
83
|
end
|
86
84
|
end
|
87
85
|
|
88
|
-
|
89
|
-
so.stdout.lines do |line|
|
86
|
+
shell_out("arp -an").stdout.lines do |line|
|
90
87
|
if line =~ /\((\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\) at ([a-fA-F0-9\:]+) on ([0-9a-zA-Z\.\:\-]+)/
|
91
88
|
next unless iface[$3] # this should never happen
|
92
89
|
|
@@ -102,8 +99,7 @@ Ohai.plugin(:Network) do
|
|
102
99
|
# Show the state of all network interfaces or a single interface
|
103
100
|
# which have been auto-configured (interfaces statically configured
|
104
101
|
# into a system, but not located at boot time are not shown).
|
105
|
-
|
106
|
-
so.stdout.lines do |line|
|
102
|
+
shell_out("netstat -idn").stdout.lines do |line|
|
107
103
|
# Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll Drop
|
108
104
|
# em0 1500 <Link> 00:11:25:2d:90:be 3719557 0 3369969 0 0 0
|
109
105
|
# $1 $2 $3 $4 $5 $6 $7 $8
|
@@ -20,10 +20,8 @@ Ohai.plugin(:Platform) do
|
|
20
20
|
provides "platform", "platform_version", "platform_family"
|
21
21
|
|
22
22
|
collect_data(:openbsd) 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 "openbsd"
|
28
26
|
end
|
29
27
|
end
|
@@ -19,7 +19,6 @@
|
|
19
19
|
Ohai.plugin(:Openstack) do
|
20
20
|
require_relative "../mixin/ec2_metadata"
|
21
21
|
require_relative "../mixin/http_helper"
|
22
|
-
require "etc" unless defined?(Etc)
|
23
22
|
include Ohai::Mixin::Ec2Metadata
|
24
23
|
include Ohai::Mixin::HttpHelper
|
25
24
|
|
@@ -49,7 +48,7 @@ Ohai.plugin(:Openstack) do
|
|
49
48
|
# https://help.dreamhost.com/hc/en-us/articles/228377408-How-to-find-the-default-user-of-an-image
|
50
49
|
def openstack_provider
|
51
50
|
# dream host doesn't support windows so bail early if we're on windows
|
52
|
-
return "openstack" if RUBY_PLATFORM
|
51
|
+
return "openstack" if RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
53
52
|
|
54
53
|
if Etc::Passwd.entries.map(&:name).include?("dhc-user")
|
55
54
|
"dreamhost"
|
@@ -59,6 +58,8 @@ Ohai.plugin(:Openstack) do
|
|
59
58
|
end
|
60
59
|
|
61
60
|
collect_data do
|
61
|
+
require "etc" unless defined?(Etc)
|
62
|
+
|
62
63
|
# fetch data if we look like openstack
|
63
64
|
if openstack_hint? || openstack_virtualization?
|
64
65
|
openstack Mash.new
|
data/lib/ohai/plugins/passwd.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
|
2
2
|
Ohai.plugin(:Passwd) do
|
3
|
-
require "etc" unless defined?(Etc)
|
4
3
|
provides "etc", "current_user"
|
5
4
|
optional true
|
6
5
|
|
@@ -14,6 +13,8 @@ Ohai.plugin(:Passwd) do
|
|
14
13
|
end
|
15
14
|
|
16
15
|
collect_data do
|
16
|
+
require "etc" unless defined?(Etc)
|
17
|
+
|
17
18
|
unless etc
|
18
19
|
etc Mash.new
|
19
20
|
|
@@ -15,7 +15,6 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
|
17
17
|
Ohai.plugin(:Rackspace) do
|
18
|
-
require "resolv"
|
19
18
|
provides "rackspace"
|
20
19
|
|
21
20
|
depends "kernel", "network/interfaces"
|
@@ -48,9 +47,9 @@ Ohai.plugin(:Rackspace) do
|
|
48
47
|
# true:: If the rackspace cloud can be identified
|
49
48
|
# false:: Otherwise
|
50
49
|
def has_rackspace_manufacturer?
|
51
|
-
return false unless RUBY_PLATFORM
|
50
|
+
return false unless RUBY_PLATFORM.match?(/mswin|mingw32|windows/)
|
52
51
|
|
53
|
-
require "wmi-lite/wmi"
|
52
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
54
53
|
wmi = WmiLite::Wmi.new
|
55
54
|
if wmi.first_of("Win32_ComputerSystem")["PrimaryOwnerName"] == "Rackspace"
|
56
55
|
logger.trace("Plugin Rackspace: has_rackspace_manufacturer? == true")
|
@@ -102,7 +101,7 @@ Ohai.plugin(:Rackspace) do
|
|
102
101
|
so = shell_out("xenstore-ls vm-data/provider_data")
|
103
102
|
if so.exitstatus == 0
|
104
103
|
so.stdout.split("\n").each do |line|
|
105
|
-
rackspace[:region] = line.split[2].delete('\"') if
|
104
|
+
rackspace[:region] = line.split[2].delete('\"') if /^region/.match?(line)
|
106
105
|
end
|
107
106
|
end
|
108
107
|
rescue Ohai::Exceptions::Exec
|
@@ -147,6 +146,8 @@ Ohai.plugin(:Rackspace) do
|
|
147
146
|
end
|
148
147
|
|
149
148
|
collect_data do
|
149
|
+
require "resolv"
|
150
|
+
|
150
151
|
# Adds rackspace Mash
|
151
152
|
if looks_like_rackspace?
|
152
153
|
rackspace Mash.new
|
@@ -19,7 +19,7 @@ Ohai.plugin(:RootGroup) do
|
|
19
19
|
provides "root_group"
|
20
20
|
|
21
21
|
collect_data(:windows) do
|
22
|
-
require "wmi-lite/wmi"
|
22
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
23
23
|
|
24
24
|
wmi = WmiLite::Wmi.new
|
25
25
|
# Per http://support.microsoft.com/kb/243330 SID: S-1-5-32-544 is the
|
data/lib/ohai/plugins/ruby.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright (c)
|
3
|
+
# Copyright:: Copyright (c) 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");
|
@@ -43,6 +43,8 @@ Ohai.plugin(:Ruby) do
|
|
43
43
|
host_vendor: "RbConfig::CONFIG['host_vendor']",
|
44
44
|
bin_dir: "RbConfig::CONFIG['bindir']",
|
45
45
|
ruby_bin: "::File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])",
|
46
|
+
gem_bin: "::File.join(RbConfig::CONFIG['bindir'], ::Gem.default_exec_format % 'gem')",
|
47
|
+
gems_dir: "::Gem.dir",
|
46
48
|
}
|
47
49
|
|
48
50
|
# Create a query string from above hash
|
@@ -52,25 +54,12 @@ Ohai.plugin(:Ruby) do
|
|
52
54
|
end
|
53
55
|
|
54
56
|
# Query the system ruby
|
55
|
-
result = run_ruby "puts %Q(#{env_string})"
|
57
|
+
result = run_ruby "require 'rubygems'; puts %Q(#{env_string})"
|
56
58
|
|
57
59
|
# Parse results to plugin hash
|
58
60
|
result.split(",").each do |entry|
|
59
61
|
key, value = entry.split("=")
|
60
62
|
languages[:ruby][key.to_sym] = value || ""
|
61
63
|
end
|
62
|
-
|
63
|
-
# Perform one more (conditional) query
|
64
|
-
bin_dir = languages[:ruby][:bin_dir]
|
65
|
-
ruby_bin = languages[:ruby][:ruby_bin]
|
66
|
-
gem_binaries = [
|
67
|
-
run_ruby("require 'rubygems'; puts ::Gem.default_exec_format % 'gem'"),
|
68
|
-
"gem",
|
69
|
-
].map { |bin| ::File.join(bin_dir, bin) }
|
70
|
-
gem_binary = gem_binaries.find { |bin| ::File.exist? bin }
|
71
|
-
if gem_binary
|
72
|
-
languages[:ruby][:gems_dir] = run_ruby "puts %x{#{ruby_bin} #{gem_binary} env gemdir}.chomp!"
|
73
|
-
languages[:ruby][:gem_bin] = gem_binary
|
74
|
-
end
|
75
64
|
end
|
76
65
|
end
|
@@ -26,7 +26,7 @@ Ohai.plugin(:Scaleway) do
|
|
26
26
|
# looks for `scaleway` keyword in kernel command line
|
27
27
|
# @return [Boolean] do we have the keyword or not?
|
28
28
|
def has_scaleway_cmdline?
|
29
|
-
if ::File.
|
29
|
+
if ::File.exist?("/proc/cmdline") && /scaleway/.match?(::File.read("/proc/cmdline"))
|
30
30
|
logger.trace("Plugin Scaleway: has_scaleway_cmdline? == true")
|
31
31
|
return true
|
32
32
|
end
|
data/lib/ohai/plugins/shard.rb
CHANGED
@@ -86,7 +86,7 @@ Ohai.plugin(:DMI) do
|
|
86
86
|
"SUN_OEM_EXT_MEMARRAY" => 144, # phys memory array extended info
|
87
87
|
"SUN_OEM_EXT_MEMDEVICE" => 145, # memory device extended info
|
88
88
|
"SMB_TYPE_OEM_HI" => 256, # end of OEM-specific type range
|
89
|
-
}
|
89
|
+
}.freeze
|
90
90
|
|
91
91
|
# all output lines should fall within one of these patterns
|
92
92
|
header_type_line = /^ID\s+SIZE\s+TYPE/
|
@@ -99,7 +99,6 @@ Ohai.plugin(:DMI) do
|
|
99
99
|
dmi_record = nil
|
100
100
|
field = nil
|
101
101
|
|
102
|
-
so = shell_out("smbios")
|
103
102
|
# ==== EXAMPLE: ====
|
104
103
|
# ID SIZE TYPE
|
105
104
|
# 0 40 SMB_TYPE_BIOS (BIOS information)
|
@@ -111,7 +110,7 @@ Ohai.plugin(:DMI) do
|
|
111
110
|
# SMB_BIOSFL_PCI (PCI is supported)
|
112
111
|
# ... similar lines trimmed
|
113
112
|
# note the second level of indentation is via a *tab*
|
114
|
-
|
113
|
+
shell_out("smbios").stdout.lines do |raw_line|
|
115
114
|
next if header_type_line.match(raw_line)
|
116
115
|
next if blank_line.match(raw_line)
|
117
116
|
|
@@ -20,8 +20,7 @@ Ohai.plugin(:Memory) do
|
|
20
20
|
collect_data(:solaris2) do
|
21
21
|
memory Mash.new
|
22
22
|
memory[:swap] = Mash.new
|
23
|
-
|
24
|
-
memory[:total] = "#{meminfo.split[2].to_i * 1024}kB"
|
23
|
+
memory[:total] = "#{shell_out("prtconf | grep Memory").stdout.split[2].to_i * 1024}kB"
|
25
24
|
|
26
25
|
tokens = shell_out("swap -s").stdout.strip.split
|
27
26
|
used_swap = tokens[8][0..-1].to_i # strip k from end
|
@@ -54,13 +54,11 @@
|
|
54
54
|
# inet6 fe80::203:baff:fe17:4444/128
|
55
55
|
|
56
56
|
# Extracted from http://illumos.org/hcl/
|
57
|
-
|
58
|
-
ETHERNET_ENCAPS = %w{ afe amd8111s arn atge ath bfe bge bnx bnxe ce cxgbe
|
57
|
+
ETHERNET_ENCAPS ||= %w{ afe amd8111s arn atge ath bfe bge bnx bnxe ce cxgbe
|
59
58
|
dmfe e1000g efe elxl emlxs eri hermon hme hxge igb
|
60
59
|
iprb ipw iwh iwi iwk iwp ixgb ixgbe mwl mxfe myri10ge
|
61
60
|
nge ntxn nxge pcn platform qfe qlc ral rge rtls rtw rwd
|
62
61
|
rwn sfe tavor vr wpi xge yge aggr}.freeze
|
63
|
-
end
|
64
62
|
|
65
63
|
Ohai.plugin(:Network) do
|
66
64
|
require_relative "../../mixin/network_helper"
|
@@ -102,10 +100,8 @@ Ohai.plugin(:Network) do
|
|
102
100
|
counters Mash.new unless counters
|
103
101
|
counters[:network] ||= Mash.new
|
104
102
|
|
105
|
-
so = shell_out("ifconfig -a")
|
106
103
|
cint = nil
|
107
|
-
|
108
|
-
so.stdout.lines do |line|
|
104
|
+
shell_out("ifconfig -a").stdout.lines do |line|
|
109
105
|
# regex: https://rubular.com/r/ZiIHbsnfiWPW1p
|
110
106
|
if line =~ /^([0-9a-zA-Z\.\:\-]+): \S+ mtu (\d+)(?: index (\d+))?/
|
111
107
|
cint = $1
|