ohai 16.4.12 → 16.7.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +11 -11
- data/bin/ohai +2 -1
- data/lib/ohai.rb +2 -1
- data/lib/ohai/application.rb +40 -0
- data/lib/ohai/common/dmi.rb +8 -3
- data/lib/ohai/config.rb +3 -3
- data/lib/ohai/dsl.rb +2 -1
- data/lib/ohai/dsl/plugin.rb +13 -5
- data/lib/ohai/dsl/plugin/versionvii.rb +29 -16
- data/lib/ohai/exception.rb +2 -1
- data/lib/ohai/hints.rb +2 -1
- data/lib/ohai/loader.rb +1 -1
- data/lib/ohai/log.rb +2 -1
- data/lib/ohai/mash.rb +1 -0
- data/lib/ohai/mixin/azure_metadata.rb +3 -2
- data/lib/ohai/mixin/chef_utils_wiring.rb +52 -0
- data/lib/ohai/mixin/command.rb +4 -54
- data/lib/ohai/mixin/constant_helper.rb +2 -1
- data/lib/ohai/mixin/dmi_decode.rb +2 -1
- data/lib/ohai/mixin/do_metadata.rb +4 -3
- data/lib/ohai/mixin/ec2_metadata.rb +5 -4
- data/lib/ohai/mixin/gce_metadata.rb +3 -2
- data/lib/ohai/mixin/http_helper.rb +2 -1
- data/lib/ohai/mixin/network_helper.rb +2 -1
- data/lib/ohai/mixin/os.rb +68 -2
- data/lib/ohai/mixin/scaleway_metadata.rb +4 -3
- data/lib/ohai/mixin/seconds_to_human.rb +2 -1
- data/lib/ohai/mixin/shell_out.rb +51 -0
- data/lib/ohai/mixin/softlayer_metadata.rb +2 -1
- data/lib/ohai/mixin/string.rb +2 -1
- data/lib/ohai/mixin/train_helpers.rb +36 -0
- data/lib/ohai/mixin/which.rb +39 -0
- data/lib/ohai/plugin_config.rb +2 -1
- data/lib/ohai/plugins/aix/kernel.rb +2 -1
- data/lib/ohai/plugins/aix/memory.rb +4 -3
- data/lib/ohai/plugins/aix/network.rb +3 -2
- data/lib/ohai/plugins/aix/platform.rb +2 -1
- data/lib/ohai/plugins/aix/uptime.rb +4 -3
- data/lib/ohai/plugins/aix/virtualization.rb +1 -1
- data/lib/ohai/plugins/azure.rb +26 -5
- data/lib/ohai/plugins/bsd/virtualization.rb +4 -3
- data/lib/ohai/plugins/c.rb +1 -0
- data/lib/ohai/plugins/chef.rb +2 -1
- data/lib/ohai/plugins/cloud.rb +2 -1
- data/lib/ohai/plugins/command.rb +2 -1
- data/lib/ohai/plugins/cpu.rb +8 -9
- data/lib/ohai/plugins/darwin/hardware.rb +1 -0
- data/lib/ohai/plugins/darwin/memory.rb +3 -4
- data/lib/ohai/plugins/darwin/network.rb +2 -1
- data/lib/ohai/plugins/darwin/platform.rb +3 -2
- data/lib/ohai/plugins/darwin/virtualization.rb +3 -2
- data/lib/ohai/plugins/digital_ocean.rb +1 -0
- data/lib/ohai/plugins/dmi.rb +2 -1
- data/lib/ohai/plugins/docker.rb +2 -1
- data/lib/ohai/plugins/dragonflybsd/memory.rb +1 -0
- data/lib/ohai/plugins/dragonflybsd/network.rb +1 -0
- data/lib/ohai/plugins/dragonflybsd/platform.rb +1 -0
- data/lib/ohai/plugins/ec2.rb +16 -9
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +2 -1
- data/lib/ohai/plugins/eucalyptus.rb +5 -2
- data/lib/ohai/plugins/filesystem.rb +5 -5
- data/lib/ohai/plugins/fips.rb +2 -1
- data/lib/ohai/plugins/freebsd/memory.rb +1 -0
- data/lib/ohai/plugins/freebsd/network.rb +1 -0
- data/lib/ohai/plugins/freebsd/platform.rb +1 -0
- data/lib/ohai/plugins/gce.rb +3 -2
- data/lib/ohai/plugins/go.rb +1 -1
- data/lib/ohai/plugins/groovy.rb +1 -1
- data/lib/ohai/plugins/haskell.rb +1 -0
- data/lib/ohai/plugins/hostname.rb +2 -1
- data/lib/ohai/plugins/init_package.rb +3 -2
- data/lib/ohai/plugins/java.rb +2 -1
- data/lib/ohai/plugins/joyent.rb +3 -2
- data/lib/ohai/plugins/kernel.rb +11 -6
- data/lib/ohai/plugins/keys.rb +2 -1
- data/lib/ohai/plugins/languages.rb +2 -1
- data/lib/ohai/plugins/libvirt.rb +2 -1
- data/lib/ohai/plugins/linode.rb +2 -1
- data/lib/ohai/plugins/linux/block_device.rb +10 -9
- data/lib/ohai/plugins/linux/hostnamectl.rb +3 -2
- data/lib/ohai/plugins/linux/interrupts.rb +4 -3
- data/lib/ohai/plugins/linux/ipc.rb +2 -1
- data/lib/ohai/plugins/linux/lsb.rb +8 -21
- data/lib/ohai/plugins/linux/lspci.rb +1 -0
- data/lib/ohai/plugins/linux/machineid.rb +5 -4
- data/lib/ohai/plugins/linux/mdadm.rb +3 -2
- data/lib/ohai/plugins/linux/memory.rb +39 -38
- data/lib/ohai/plugins/linux/network.rb +14 -13
- data/lib/ohai/plugins/linux/platform.rb +32 -31
- data/lib/ohai/plugins/linux/selinux.rb +1 -0
- data/lib/ohai/plugins/linux/sessions.rb +1 -0
- data/lib/ohai/plugins/linux/sysctl.rb +1 -0
- data/lib/ohai/plugins/linux/systemd_paths.rb +1 -0
- data/lib/ohai/plugins/linux/virtualization.rb +25 -24
- data/lib/ohai/plugins/lua.rb +1 -1
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/netbsd/memory.rb +1 -0
- data/lib/ohai/plugins/netbsd/network.rb +1 -0
- data/lib/ohai/plugins/netbsd/platform.rb +1 -0
- data/lib/ohai/plugins/network.rb +2 -1
- data/lib/ohai/plugins/nodejs.rb +1 -1
- data/lib/ohai/plugins/ohai.rb +1 -0
- data/lib/ohai/plugins/ohai_time.rb +3 -2
- data/lib/ohai/plugins/openbsd/memory.rb +1 -0
- data/lib/ohai/plugins/openbsd/network.rb +1 -0
- data/lib/ohai/plugins/openbsd/platform.rb +1 -0
- data/lib/ohai/plugins/openstack.rb +2 -1
- data/lib/ohai/plugins/os.rb +6 -1
- data/lib/ohai/plugins/packages.rb +21 -0
- data/lib/ohai/plugins/passwd.rb +58 -1
- data/lib/ohai/plugins/perl.rb +2 -2
- data/lib/ohai/plugins/php.rb +1 -1
- data/lib/ohai/plugins/platform.rb +2 -1
- data/lib/ohai/plugins/powershell.rb +2 -2
- data/lib/ohai/plugins/ps.rb +2 -1
- data/lib/ohai/plugins/python.rb +2 -2
- data/lib/ohai/plugins/rackspace.rb +4 -3
- data/lib/ohai/plugins/root_group.rb +1 -0
- data/lib/ohai/plugins/ruby.rb +3 -2
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/scala.rb +1 -0
- data/lib/ohai/plugins/scaleway.rb +2 -1
- data/lib/ohai/plugins/scsi.rb +1 -0
- data/lib/ohai/plugins/shard.rb +2 -2
- data/lib/ohai/plugins/shells.rb +4 -3
- data/lib/ohai/plugins/softlayer.rb +2 -1
- data/lib/ohai/plugins/solaris2/dmi.rb +2 -1
- data/lib/ohai/plugins/solaris2/memory.rb +1 -0
- data/lib/ohai/plugins/solaris2/network.rb +7 -8
- data/lib/ohai/plugins/solaris2/platform.rb +9 -15
- data/lib/ohai/plugins/solaris2/virtualization.rb +4 -3
- data/lib/ohai/plugins/ssh_host_key.rb +14 -13
- data/lib/ohai/plugins/sysconf.rb +1 -0
- data/lib/ohai/plugins/timezone.rb +1 -0
- data/lib/ohai/plugins/train.rb +36 -0
- data/lib/ohai/plugins/uptime.rb +3 -2
- data/lib/ohai/plugins/virtualbox.rb +2 -1
- data/lib/ohai/plugins/vmware.rb +3 -2
- data/lib/ohai/plugins/windows/dmi.rb +1 -0
- data/lib/ohai/plugins/windows/drivers.rb +2 -1
- data/lib/ohai/plugins/windows/memory.rb +1 -0
- data/lib/ohai/plugins/windows/network.rb +3 -2
- data/lib/ohai/plugins/windows/platform.rb +2 -1
- data/lib/ohai/plugins/windows/system_enclosure.rb +2 -1
- data/lib/ohai/plugins/windows/virtualization.rb +2 -1
- data/lib/ohai/plugins/zpools.rb +6 -3
- data/lib/ohai/provides_map.rb +2 -1
- data/lib/ohai/runner.rb +8 -5
- data/lib/ohai/system.rb +35 -7
- data/lib/ohai/train_transport.rb +29 -0
- data/lib/ohai/util/file_helper.rb +5 -37
- data/lib/ohai/util/ip_helper.rb +1 -0
- data/lib/ohai/util/win32.rb +2 -1
- data/lib/ohai/version.rb +4 -3
- data/ohai.gemspec +8 -7
- metadata +80 -60
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Kurt Yoder (ktyopscode@yoderhome.com)
|
3
4
|
# Copyright:: Copyright (c) 2010 Kurt Yoder
|
@@ -128,7 +129,7 @@ Ohai.plugin(:DMI) do
|
|
128
129
|
id = smb_to_id[header_information[3]]
|
129
130
|
|
130
131
|
# Don't overcapture for now (OHAI-260)
|
131
|
-
unless Ohai::Common::DMI.
|
132
|
+
unless Ohai::Common::DMI.allowlisted_ids.include?(id)
|
132
133
|
dmi_record = nil
|
133
134
|
next
|
134
135
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Benjamin Black (<nostromo@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -86,7 +87,7 @@ Ohai.plugin(:Network) do
|
|
86
87
|
|
87
88
|
def full_interface_name(iface, part_name, index)
|
88
89
|
iface.each do |name, attrs|
|
89
|
-
next unless attrs
|
90
|
+
next unless attrs.respond_to?(:[])
|
90
91
|
return name if /^#{part_name}($|:)/.match(name) && attrs[:index] == index
|
91
92
|
end
|
92
93
|
|
@@ -155,12 +156,10 @@ Ohai.plugin(:Network) do
|
|
155
156
|
break
|
156
157
|
end
|
157
158
|
end
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
break
|
163
|
-
end
|
159
|
+
iface[ifn][:arp]&.each_key do |addr|
|
160
|
+
if addr.eql?(iaddr)
|
161
|
+
iface[ifn][:addresses][iface[ifn][:arp][iaddr]] = { "family" => "lladdr" }
|
162
|
+
break
|
164
163
|
end
|
165
164
|
end
|
166
165
|
end
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Benjamin Black (<nostromo@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -20,7 +21,7 @@ Ohai.plugin(:Platform) do
|
|
20
21
|
provides "platform", "platform_version", "platform_build", "platform_family"
|
21
22
|
|
22
23
|
collect_data(:solaris2) do
|
23
|
-
if
|
24
|
+
if file_exist?("/sbin/uname")
|
24
25
|
uname_exec = "/sbin/uname"
|
25
26
|
else
|
26
27
|
uname_exec = "uname"
|
@@ -35,26 +36,19 @@ Ohai.plugin(:Platform) do
|
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
38
|
-
|
39
|
+
file_open("/etc/release") do |file|
|
39
40
|
while ( line = file.gets )
|
40
41
|
case line
|
41
|
-
when
|
42
|
+
when /.*SmartOS.*/
|
42
43
|
platform "smartos"
|
43
|
-
when /^\s*
|
44
|
+
when /^\s*OmniOS.*r(\d+).*$/
|
44
45
|
platform "omnios"
|
45
|
-
platform_version $
|
46
|
-
when /^\s*
|
46
|
+
platform_version $1
|
47
|
+
when /^\s*OpenIndiana.*(Development oi_|Hipster )(\d\S*)/ # https://rubular.com/r/iMtOBwbnyqDz7u
|
47
48
|
platform "openindiana"
|
48
49
|
platform_version $2
|
49
|
-
when /^\s*(
|
50
|
-
platform "opensolaris"
|
51
|
-
platform_version $2
|
52
|
-
when /^\s*(Oracle Solaris)/
|
53
|
-
platform "solaris2"
|
54
|
-
when /^\s*(Solaris)\s.*$/
|
50
|
+
when /^\s*(Oracle Solaris|Solaris)/
|
55
51
|
platform "solaris2"
|
56
|
-
when /^\s*(NexentaCore)\s.*$/
|
57
|
-
platform "nexentacore"
|
58
52
|
end
|
59
53
|
end
|
60
54
|
end
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Sean Walbran (<seanwalbran@gmail.com>)
|
3
4
|
# Author:: Kurt Yoder (<ktyopscode@yoderhome.com>)
|
4
|
-
# Copyright:: Copyright (c)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
6
|
# Copyright:: Copyright (c) 2010 Kurt Yoder
|
6
7
|
# License:: Apache License, Version 2.0
|
7
8
|
#
|
@@ -34,7 +35,7 @@ Ohai.plugin(:Virtualization) do
|
|
34
35
|
|
35
36
|
# Detect paravirt KVM/QEMU from cpuinfo, report as KVM
|
36
37
|
psrinfo_path = Ohai.abs_path( "/usr/sbin/psrinfo" )
|
37
|
-
if
|
38
|
+
if file_exist?(psrinfo_path)
|
38
39
|
so = shell_out("#{psrinfo_path} -pv")
|
39
40
|
if /QEMU Virtual CPU|Common KVM processor|Common 32-bit KVM processor/.match?(so.stdout)
|
40
41
|
virtualization[:system] = "kvm"
|
@@ -55,7 +56,7 @@ Ohai.plugin(:Virtualization) do
|
|
55
56
|
if File.executable?("/usr/sbin/zoneadm")
|
56
57
|
zones = Mash.new
|
57
58
|
shell_out("zoneadm list -pc").stdout.lines do |line|
|
58
|
-
info = line.chomp.split(
|
59
|
+
info = line.chomp.split(":")
|
59
60
|
zones[info[1]] = {
|
60
61
|
"id" => info[0],
|
61
62
|
"state" => info[2],
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Bryan McLellan <btm@chef.io>
|
3
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -38,9 +39,9 @@ Ohai.plugin(:SSHHostKey) do
|
|
38
39
|
collect_data do
|
39
40
|
keys[:ssh] = Mash.new
|
40
41
|
|
41
|
-
sshd_config = if
|
42
|
+
sshd_config = if file_exist?("/etc/ssh/sshd_config")
|
42
43
|
"/etc/ssh/sshd_config"
|
43
|
-
elsif
|
44
|
+
elsif file_exist?("/etc/sshd_config")
|
44
45
|
# Darwin
|
45
46
|
"/etc/sshd_config"
|
46
47
|
else
|
@@ -49,11 +50,11 @@ Ohai.plugin(:SSHHostKey) do
|
|
49
50
|
end
|
50
51
|
|
51
52
|
if sshd_config
|
52
|
-
|
53
|
+
file_open(sshd_config) do |conf|
|
53
54
|
conf.each_line do |line|
|
54
55
|
if /^hostkey\s/i.match?(line)
|
55
56
|
pub_file = "#{line.split[1]}.pub"
|
56
|
-
content =
|
57
|
+
content = file_read(pub_file).split
|
57
58
|
key_type, key_subtype = extract_keytype?(content)
|
58
59
|
keys[:ssh]["host_#{key_type}_public"] = content[1] unless key_type.nil?
|
59
60
|
keys[:ssh]["host_#{key_type}_type"] = key_subtype unless key_subtype.nil?
|
@@ -62,22 +63,22 @@ Ohai.plugin(:SSHHostKey) do
|
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
65
|
-
if keys[:ssh][:host_dsa_public].nil? &&
|
66
|
-
keys[:ssh][:host_dsa_public] =
|
66
|
+
if keys[:ssh][:host_dsa_public].nil? && file_exist?("/etc/ssh/ssh_host_dsa_key.pub")
|
67
|
+
keys[:ssh][:host_dsa_public] = file_read("/etc/ssh/ssh_host_dsa_key.pub").split[1]
|
67
68
|
end
|
68
69
|
|
69
|
-
if keys[:ssh][:host_rsa_public].nil? &&
|
70
|
-
keys[:ssh][:host_rsa_public] =
|
70
|
+
if keys[:ssh][:host_rsa_public].nil? && file_exist?("/etc/ssh/ssh_host_rsa_key.pub")
|
71
|
+
keys[:ssh][:host_rsa_public] = file_read("/etc/ssh/ssh_host_rsa_key.pub").split[1]
|
71
72
|
end
|
72
73
|
|
73
|
-
if keys[:ssh][:host_ecdsa_public].nil? &&
|
74
|
-
content =
|
74
|
+
if keys[:ssh][:host_ecdsa_public].nil? && file_exist?("/etc/ssh/ssh_host_ecdsa_key.pub")
|
75
|
+
content = file_read("/etc/ssh/ssh_host_ecdsa_key.pub")
|
75
76
|
keys[:ssh][:host_ecdsa_public] = content.split[1]
|
76
77
|
keys[:ssh][:host_ecdsa_type] = content.split[0]
|
77
78
|
end
|
78
79
|
|
79
|
-
if keys[:ssh][:host_ed25519_public].nil? &&
|
80
|
-
keys[:ssh][:host_ed25519_public] =
|
80
|
+
if keys[:ssh][:host_ed25519_public].nil? && file_exist?("/etc/ssh/ssh_host_ed25519_key.pub")
|
81
|
+
keys[:ssh][:host_ed25519_public] = file_read("/etc/ssh/ssh_host_ed25519_key.pub").split[1]
|
81
82
|
end
|
82
83
|
end
|
83
84
|
end
|
data/lib/ohai/plugins/sysconf.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
Ohai.plugin(:Train) do
|
20
|
+
provides "train"
|
21
|
+
|
22
|
+
collect_data do
|
23
|
+
if transport_connection
|
24
|
+
train Mash.new
|
25
|
+
train["family_hierarchy"] = transport_connection.platform.family_hierarchy
|
26
|
+
train["family"] = transport_connection.platform.family
|
27
|
+
train["platform"] = transport_connection.platform.platform
|
28
|
+
train["backend"] = transport_connection.backend_type
|
29
|
+
if transport_connection.respond_to?(:uri)
|
30
|
+
train["scheme"] = URI.parse(transport_connection.uri).scheme
|
31
|
+
train["uri"] = transport_connection.uri
|
32
|
+
else
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/ohai/plugins/uptime.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Author:: Bryan McLellan (<btm@loftninjas.org>)
|
@@ -5,7 +6,7 @@
|
|
5
6
|
# Author:: Doug MacEachern (<dougm@vmware.com>)
|
6
7
|
# Author:: Kurt Yoder (<ktyopscode@yoderhome.com>)
|
7
8
|
# Author:: Paul Mooring (<paul@chef.io>)
|
8
|
-
# Copyright:: Copyright (c)
|
9
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
9
10
|
# Copyright:: Copyright (c) 2009 Bryan McLellan
|
10
11
|
# Copyright:: Copyright (c) 2010 VMware, Inc.
|
11
12
|
# License:: Apache License, Version 2.0
|
@@ -54,7 +55,7 @@ Ohai.plugin(:Uptime) do
|
|
54
55
|
end
|
55
56
|
|
56
57
|
collect_data(:linux) do
|
57
|
-
uptime, idletime =
|
58
|
+
uptime, idletime = file_open("/proc/uptime").gets.split(" ")
|
58
59
|
uptime_seconds uptime.to_i
|
59
60
|
uptime seconds_to_human(uptime.to_i)
|
60
61
|
idletime_seconds idletime.to_i
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Tim Smith <tsmith@chef.io>
|
3
4
|
# Author:: Joshua Colson <joshua.colson@gmail.com>
|
4
|
-
# Copyright::
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
6
|
# Copyright:: 2019 Joshua Colson
|
6
7
|
# License:: Apache License, Version 2.0
|
7
8
|
#
|
data/lib/ohai/plugins/vmware.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: "Dan Robinson" <drobinson@chef.io>
|
3
4
|
# Author:: "Christopher M. Luciano" <cmlucian@us.ibm.com>
|
4
|
-
# Copyright:: Copyright (c)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
6
|
# Copyright (C) 2015 IBM Corp.
|
6
7
|
# License:: Apache License, Version 2.0
|
7
8
|
#
|
@@ -41,7 +42,7 @@ Ohai.plugin(:VMware) do
|
|
41
42
|
end
|
42
43
|
|
43
44
|
def get_vm_attributes(vmtools_path)
|
44
|
-
if !
|
45
|
+
if !file_exist?(vmtools_path)
|
45
46
|
logger.trace("Plugin VMware: #{vmtools_path} not found")
|
46
47
|
else
|
47
48
|
vmware Mash.new
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: James Gartrell (<jgartrel@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -205,7 +206,7 @@ Ohai.plugin(:Network) do
|
|
205
206
|
so = shell_out("arp -a")
|
206
207
|
if so.exitstatus == 0
|
207
208
|
so.stdout.lines do |line|
|
208
|
-
if line =~ /^Interface:\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s
|
209
|
+
if line =~ /^Interface:\s+(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s+-+\s+(0x\S+)/
|
209
210
|
cint = $2.downcase
|
210
211
|
end
|
211
212
|
next unless iface[cint]
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: James Gartrell (<jgartrel@gmail.com>)
|
3
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Stuart Preston (<stuart@chef.io>)
|
3
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Pavel Yudin (<pyudin@parallels.com>)
|
3
4
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
4
5
|
# Copyright:: Copyright (c) 2015 Pavel Yudin
|
5
|
-
# Copyright:: Copyright (c)
|
6
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
7
|
# License:: Apache License, Version 2.0
|
7
8
|
#
|
8
9
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/plugins/zpools.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Jason J. W. Williams (williamsjj@digitar.com)
|
3
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -65,7 +66,9 @@ Ohai.plugin(:Zpools) do
|
|
65
66
|
if platform_family == "solaris2"
|
66
67
|
command = "su adm -c \"zpool status #{pool}\""
|
67
68
|
else
|
68
|
-
|
69
|
+
# -L is used to give us real device names not label or uuid
|
70
|
+
# for example sda instead of ata-WDC_WD60EZAZ-00SF3B0_WD-WX32D203UXYK
|
71
|
+
command = "zpool status #{pool} -L"
|
69
72
|
end
|
70
73
|
|
71
74
|
so = shell_out(command)
|
@@ -74,7 +77,7 @@ Ohai.plugin(:Zpools) do
|
|
74
77
|
# linux: http://rubular.com/r/J3wQC6E2lH
|
75
78
|
# solaris: http://rubular.com/r/FqOBzUQQ4p
|
76
79
|
# freebsd: http://rubular.com/r/RYkMNlytXl
|
77
|
-
when /^\s+((sd|c|ad|da)[-_a-zA-Z0-9]+)\s+([-_a-zA-Z0-9]+)\s+(\d+)\s+(\d+)\s+(\d+)$/
|
80
|
+
when /^\s+((sd|c|ad|da|nvme|xvd)[-_a-zA-Z0-9]+)\s+([-_a-zA-Z0-9]+)\s+(\d+)\s+(\d+)\s+(\d+)$/
|
78
81
|
logger.trace("Plugin Zpools: Parsing zpool status line: #{line.chomp}")
|
79
82
|
pools[pool][:devices][$1] = Mash.new
|
80
83
|
pools[pool][:devices][$1][:state] = $3
|
data/lib/ohai/provides_map.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
4
|
-
# Copyright:: Copyright (c)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
6
|
# License:: Apache License, Version 2.0
|
6
7
|
#
|
7
8
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/ohai/runner.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Claire McQuin (<claire@chef.io>)
|
3
|
-
# Copyright:: Copyright (c)
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License"); you
|
@@ -24,6 +25,9 @@ module Ohai
|
|
24
25
|
class Runner
|
25
26
|
|
26
27
|
attr_reader :failed_plugins, :logger
|
28
|
+
|
29
|
+
attr_accessor :transport_connection
|
30
|
+
|
27
31
|
# safe_run: set to true if this runner will run plugins in
|
28
32
|
# safe-mode. default false.
|
29
33
|
def initialize(controller, safe_run = false)
|
@@ -54,15 +58,13 @@ module Ohai
|
|
54
58
|
else
|
55
59
|
raise Ohai::Exceptions::InvalidPlugin, "Invalid plugin version #{plugin.version} for plugin #{plugin}"
|
56
60
|
end
|
57
|
-
rescue Ohai::Exceptions::Error #
|
58
|
-
raise
|
59
|
-
rescue SystemExit # abort or exit from plug-in should exit Ohai with failure code
|
61
|
+
rescue Ohai::Exceptions::Error, SystemExit # SystemExit: abort or exit from plug-in should exit Ohai with failure code
|
60
62
|
raise
|
61
63
|
rescue Exception => e
|
62
64
|
logger.trace("Plugin #{plugin.name} threw exception #{e.inspect} #{e.backtrace.join("\n")}")
|
63
65
|
end
|
64
66
|
end
|
65
|
-
logger.trace("Plugin #{plugin.name} took #{elapsed} seconds to run.")
|
67
|
+
logger.trace("Plugin #{plugin.name} took #{"%f" % elapsed.truncate(6)} seconds to run.")
|
66
68
|
end
|
67
69
|
|
68
70
|
# @param [Ohai::DSL::Plugin] plugin
|
@@ -93,6 +95,7 @@ module Ohai
|
|
93
95
|
end
|
94
96
|
|
95
97
|
if dependency_providers.empty?
|
98
|
+
next_plugin.transport_connection = transport_connection
|
96
99
|
@safe_run ? next_plugin.safe_run : next_plugin.run
|
97
100
|
if next_plugin.failed
|
98
101
|
@failed_plugins << next_plugin.name
|