ohai 16.7.18 → 16.10.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -4
- data/lib/ohai/dsl/plugin.rb +1 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +0 -2
- data/lib/ohai/mixin/azure_metadata.rb +2 -2
- data/lib/ohai/mixin/ec2_metadata.rb +35 -10
- data/lib/ohai/mixin/gce_metadata.rb +1 -1
- data/lib/ohai/plugins/aix/kernel.rb +6 -4
- data/lib/ohai/plugins/aix/memory.rb +3 -3
- data/lib/ohai/plugins/aix/network.rb +50 -58
- data/lib/ohai/plugins/aix/platform.rb +2 -2
- data/lib/ohai/plugins/aix/virtualization.rb +6 -6
- data/lib/ohai/plugins/bsd/virtualization.rb +1 -1
- data/lib/ohai/plugins/c.rb +3 -3
- data/lib/ohai/plugins/cloud.rb +1 -1
- data/lib/ohai/plugins/cpu.rb +25 -25
- data/lib/ohai/plugins/darwin/network.rb +7 -9
- data/lib/ohai/plugins/digital_ocean.rb +2 -1
- data/lib/ohai/plugins/dmi.rb +4 -4
- data/lib/ohai/plugins/docker.rb +1 -1
- data/lib/ohai/plugins/dragonflybsd/memory.rb +8 -8
- data/lib/ohai/plugins/dragonflybsd/platform.rb +2 -2
- data/lib/ohai/plugins/ec2.rb +3 -0
- data/lib/ohai/plugins/eucalyptus.rb +1 -1
- data/lib/ohai/plugins/freebsd/memory.rb +8 -8
- data/lib/ohai/plugins/freebsd/platform.rb +2 -2
- data/lib/ohai/plugins/grub2.rb +40 -0
- data/lib/ohai/plugins/hostname.rb +1 -2
- data/lib/ohai/plugins/kernel.rb +5 -7
- data/lib/ohai/plugins/libvirt.rb +3 -3
- data/lib/ohai/plugins/linode.rb +21 -14
- data/lib/ohai/plugins/linux/lspci.rb +0 -1
- data/lib/ohai/plugins/linux/network.rb +29 -4
- data/lib/ohai/plugins/linux/platform.rb +4 -1
- data/lib/ohai/plugins/netbsd/platform.rb +2 -2
- data/lib/ohai/plugins/network.rb +1 -1
- data/lib/ohai/plugins/openbsd/platform.rb +2 -2
- data/lib/ohai/plugins/os.rb +1 -1
- data/lib/ohai/plugins/packages.rb +1 -1
- data/lib/ohai/plugins/passwd.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +4 -4
- data/lib/ohai/plugins/scaleway.rb +1 -1
- data/lib/ohai/plugins/scsi.rb +0 -1
- data/lib/ohai/plugins/solaris2/network.rb +1 -1
- data/lib/ohai/plugins/solaris2/virtualization.rb +1 -2
- data/lib/ohai/plugins/train.rb +0 -1
- data/lib/ohai/plugins/uptime.rb +1 -1
- data/lib/ohai/plugins/virtualbox.rb +1 -1
- data/lib/ohai/plugins/vmware.rb +1 -2
- data/lib/ohai/plugins/zpools.rb +0 -1
- data/lib/ohai/util/ip_helper.rb +1 -1
- data/lib/ohai/version.rb +1 -1
- data/ohai.gemspec +1 -1
- metadata +14 -14
- data/lib/ohai/plugins/joyent.rb +0 -78
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c661e4c6ab76f9c2e8e8fb2ae7d287caa31d81c1b3149f689c8d00853d392488
|
4
|
+
data.tar.gz: e48961c413eafcbb0af751b34b9fb7dd805ae2e7d0650dcecbf1cf2b8adbe691
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72849d5d2c327b4994aa073d85556bbd3b2a0ef200646593a2f62cc283c39ee435b99a81c87f56b31583dbf99e174a365d08c634ee91863d0a19b1c0d261f40e
|
7
|
+
data.tar.gz: c5104a84a7067fff9dde9d5e456107e300bd5e6f42dd3d42684ac491cdbaf511fb9c31741cf4763c0dbfeacc08008dc9f517568c31d1873ea7228b32bf33bcde
|
data/Gemfile
CHANGED
@@ -4,19 +4,19 @@ source "https://rubygems.org"
|
|
4
4
|
gemspec
|
5
5
|
|
6
6
|
# pull these gems from master of chef/chef so that we're testing against what we will release
|
7
|
-
gem "chef-config", git: "https://github.com/chef/chef", glob: "chef-config/chef-config.gemspec"
|
8
|
-
gem "chef-utils", git: "https://github.com/chef/chef", glob: "chef-utils/chef-utils.gemspec"
|
7
|
+
gem "chef-config", git: "https://github.com/chef/chef", branch: "chef-16", glob: "chef-config/chef-config.gemspec"
|
8
|
+
gem "chef-utils", git: "https://github.com/chef/chef", branch: "chef-16", glob: "chef-utils/chef-utils.gemspec"
|
9
9
|
|
10
10
|
# NOTE: do not submit PRs to add pry as a dep, add to your Gemfile.local
|
11
11
|
group :development do
|
12
|
-
gem "chefstyle",
|
12
|
+
gem "chefstyle", "1.6.2"
|
13
13
|
gem "ipaddr_extensions"
|
14
14
|
gem "rake", ">= 10.1.0"
|
15
15
|
gem "rspec-collection_matchers", "~> 1.0"
|
16
16
|
gem "rspec-core", "~> 3.0"
|
17
17
|
gem "rspec-expectations", "~> 3.0"
|
18
18
|
gem "rspec-mocks", "~> 3.0"
|
19
|
-
gem "rubocop-performance", "1.
|
19
|
+
gem "rubocop-performance", "1.9.2"
|
20
20
|
gem "rubocop-rspec"
|
21
21
|
end
|
22
22
|
|
data/lib/ohai/dsl/plugin.rb
CHANGED
@@ -218,7 +218,7 @@ module Ohai
|
|
218
218
|
def safe_get_attribute(*keys)
|
219
219
|
keys.inject(@data) do |attrs, key|
|
220
220
|
unless attrs.nil? || attrs.is_a?(Array) || attrs.is_a?(Hash)
|
221
|
-
raise TypeError
|
221
|
+
raise TypeError, "Expected Hash but got #{attrs.class}."
|
222
222
|
end
|
223
223
|
|
224
224
|
attrs[key]
|
@@ -36,8 +36,8 @@ module Ohai
|
|
36
36
|
|
37
37
|
# it's important that the newer versions are at the end of this array so we can skip sorting it
|
38
38
|
AZURE_SUPPORTED_VERSIONS ||= %w{ 2017-04-02 2017-08-01 2017-12-01 2018-02-01 2018-04-02
|
39
|
-
|
40
|
-
|
39
|
+
2018-10-01 2019-02-01 2019-03-11 2019-04-30 2019-06-01
|
40
|
+
2019-06-04 2019-08-01 2019-08-15 2019-11-01 }.freeze
|
41
41
|
|
42
42
|
def best_api_version
|
43
43
|
@api_version ||= begin
|
@@ -42,23 +42,31 @@ module Ohai
|
|
42
42
|
|
43
43
|
EC2_METADATA_ADDR ||= "169.254.169.254"
|
44
44
|
EC2_SUPPORTED_VERSIONS ||= %w{ 1.0 2007-01-19 2007-03-01 2007-08-29 2007-10-10 2007-12-15
|
45
|
-
|
46
|
-
|
45
|
+
2008-02-01 2008-09-01 2009-04-04 2011-01-01 2011-05-01 2012-01-12
|
46
|
+
2014-02-25 2014-11-05 2015-10-20 2016-04-19 2016-06-30 2016-09-02
|
47
|
+
2016-11-30 2018-08-17 2018-11-29 2019-10-01 2020-08-24 2020-11-01 }.freeze
|
47
48
|
EC2_ARRAY_VALUES ||= %w{security-groups local_ipv4s}.freeze
|
48
49
|
EC2_ARRAY_DIR ||= %w{network/interfaces/macs}.freeze
|
49
50
|
EC2_JSON_DIR ||= %w{iam}.freeze
|
50
51
|
|
52
|
+
#
|
53
|
+
# The latest metadata version in EC2_SUPPORTED_VERSIONS that this instance supports
|
54
|
+
# in AWS supported metadata versions are determined at instance start so we need to be
|
55
|
+
# cautious here in case an instance has been running for a long time
|
56
|
+
#
|
57
|
+
# @return [String] the version
|
58
|
+
#
|
51
59
|
def best_api_version
|
52
60
|
@api_version ||= begin
|
53
61
|
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}/ to determine the latest supported metadata release")
|
54
|
-
response = http_client.get("/")
|
62
|
+
response = http_client.get("/", { 'X-aws-ec2-metadata-token': v2_token })
|
55
63
|
if response.code == "404"
|
56
64
|
logger.trace("Mixin EC2: Received HTTP 404 from metadata server while determining API version, assuming 'latest'")
|
57
65
|
return "latest"
|
58
66
|
elsif response.code != "200"
|
59
67
|
raise "Mixin EC2: Unable to determine EC2 metadata version (returned #{response.code} response)"
|
60
68
|
end
|
61
|
-
#
|
69
|
+
# NOTE: Sorting the list of versions may have unintended consequences in
|
62
70
|
# non-EC2 environments. It appears to be safe in EC2 as of 2013-04-12.
|
63
71
|
versions = response.body.split("\n").sort
|
64
72
|
until versions.empty? || EC2_SUPPORTED_VERSIONS.include?(versions.last)
|
@@ -84,6 +92,23 @@ module Ohai
|
|
84
92
|
end
|
85
93
|
end
|
86
94
|
|
95
|
+
#
|
96
|
+
# Fetch an API token for use querying AWS IMDSv2 or return nil if no token if found
|
97
|
+
# AWS like systems (think OpenStack) will not respond with a token here
|
98
|
+
#
|
99
|
+
# @return [NilClass, String] API token or nil
|
100
|
+
#
|
101
|
+
def v2_token
|
102
|
+
@v2_token ||= begin
|
103
|
+
request = http_client.put("/latest/api/token", nil, { 'X-aws-ec2-metadata-token-ttl-seconds': "60" })
|
104
|
+
if request.code == "404" # not on AWS
|
105
|
+
nil
|
106
|
+
else
|
107
|
+
request.body
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
87
112
|
# Get metadata for a given path and API version
|
88
113
|
#
|
89
114
|
# Typically, a 200 response is expected for valid metadata.
|
@@ -93,7 +118,7 @@ module Ohai
|
|
93
118
|
def metadata_get(id, api_version)
|
94
119
|
path = "/#{api_version}/meta-data/#{id}"
|
95
120
|
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}#{path}")
|
96
|
-
response = http_client.get(path)
|
121
|
+
response = http_client.get(path, { 'X-aws-ec2-metadata-token': v2_token })
|
97
122
|
case response.code
|
98
123
|
when "200"
|
99
124
|
response.body
|
@@ -119,7 +144,7 @@ module Ohai
|
|
119
144
|
else
|
120
145
|
metadata_get(key, best_api_version)
|
121
146
|
end
|
122
|
-
elsif (
|
147
|
+
elsif (!key.eql?(id)) && (!key.eql?("/"))
|
123
148
|
name = key[0..-2]
|
124
149
|
sym = metadata_key(name)
|
125
150
|
if EC2_ARRAY_DIR.include?(name)
|
@@ -144,7 +169,7 @@ module Ohai
|
|
144
169
|
if key[-1..-1] != "/"
|
145
170
|
retr_meta = metadata_get("#{id}#{key}", api_version)
|
146
171
|
metadata[metadata_key(key)] = retr_meta || ""
|
147
|
-
elsif
|
172
|
+
elsif !key.eql?("/")
|
148
173
|
metadata[key[0..-2]] = fetch_dir_metadata("#{id}#{key}", api_version)
|
149
174
|
end
|
150
175
|
end
|
@@ -164,7 +189,7 @@ module Ohai
|
|
164
189
|
json = String(data)
|
165
190
|
parser = FFI_Yajl::Parser.new
|
166
191
|
metadata[metadata_key(key)] = parser.parse(json)
|
167
|
-
elsif
|
192
|
+
elsif !key.eql?("/")
|
168
193
|
metadata[key[0..-2]] = fetch_json_dir_metadata("#{id}#{key}", api_version)
|
169
194
|
end
|
170
195
|
end
|
@@ -174,13 +199,13 @@ module Ohai
|
|
174
199
|
|
175
200
|
def fetch_userdata
|
176
201
|
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}/#{best_api_version}/user-data/")
|
177
|
-
response = http_client.get("/#{best_api_version}/user-data/")
|
202
|
+
response = http_client.get("/#{best_api_version}/user-data/", { 'X-aws-ec2-metadata-token': v2_token })
|
178
203
|
response.code == "200" ? response.body : nil
|
179
204
|
end
|
180
205
|
|
181
206
|
def fetch_dynamic_data
|
182
207
|
@fetch_dynamic_data ||= begin
|
183
|
-
response = http_client.get("/#{best_api_version}/dynamic/instance-identity/document/")
|
208
|
+
response = http_client.get("/#{best_api_version}/dynamic/instance-identity/document/", { 'X-aws-ec2-metadata-token': v2_token })
|
184
209
|
|
185
210
|
if json?(response.body) && response.code == "200"
|
186
211
|
FFI_Yajl::Parser.parse(response.body)
|
@@ -24,10 +24,12 @@ Ohai.plugin(:Kernel) do
|
|
24
24
|
collect_data(:aix) do
|
25
25
|
kernel Mash.new
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
kernel[:
|
30
|
-
kernel[:
|
27
|
+
uname_so = shell_out("uname -rvp").stdout.split
|
28
|
+
|
29
|
+
kernel[:name] = "aix" # this is here for historical reasons, but it's always aix
|
30
|
+
kernel[:release] = uname_so[0]
|
31
|
+
kernel[:version] = uname_so[1]
|
32
|
+
kernel[:machine] = uname_so[2]
|
31
33
|
kernel[:bits] = shell_out("getconf KERNEL_BITMODE").stdout.strip
|
32
34
|
|
33
35
|
modules = Mash.new
|
@@ -25,10 +25,10 @@ Ohai.plugin(:Memory) do
|
|
25
25
|
memory Mash.new
|
26
26
|
memory[:swap] = Mash.new
|
27
27
|
|
28
|
-
meminfo = shell_out("svmon -G -O unit=
|
28
|
+
meminfo = shell_out("svmon -G -O unit=KB,summary=longreal | grep '[0-9]'").stdout
|
29
29
|
total_in_mb, _u, free_in_mb = meminfo.split
|
30
|
-
memory[:total] = "#{total_in_mb.to_i
|
31
|
-
memory[:free] = "#{free_in_mb.to_i
|
30
|
+
memory[:total] = "#{total_in_mb.to_i}kB"
|
31
|
+
memory[:free] = "#{free_in_mb.to_i}kB"
|
32
32
|
|
33
33
|
swap_info = shell_out("swap -s").stdout.split # returns swap info in 4K blocks
|
34
34
|
memory[:swap]["total"] = "#{swap_info[2].to_i * 4}kB"
|
@@ -22,7 +22,7 @@
|
|
22
22
|
Ohai.plugin(:Network) do
|
23
23
|
require_relative "../../mixin/network_helper"
|
24
24
|
|
25
|
-
provides "network", "counters/network", "macaddress"
|
25
|
+
provides "network", "network/interfaces", "counters/network", "macaddress"
|
26
26
|
|
27
27
|
include Ohai::Mixin::NetworkHelper
|
28
28
|
|
@@ -38,46 +38,44 @@ Ohai.plugin(:Network) do
|
|
38
38
|
# => state up/down (ifconfig/lsattr)
|
39
39
|
# => arp (arp -an)
|
40
40
|
|
41
|
-
|
41
|
+
ifaces = Mash.new
|
42
42
|
|
43
43
|
network Mash.new unless network
|
44
|
-
network[:interfaces] ||= Mash.new
|
45
44
|
|
46
45
|
# We unfortunately have to do things a bit different here, if ohai is running
|
47
46
|
# within a WPAR. For instance, the WPAR isn't aware of some of its own networking
|
48
|
-
# minutia such as default gateway/route.
|
47
|
+
# minutia such as default gateway/route. lpars return 0 here. wpars return > 0
|
49
48
|
unless shell_out("uname -W").stdout.to_i > 0
|
50
49
|
# :default_interface, :default_gateway - route -n get 0
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
50
|
+
default_line = shell_out("netstat -rn")
|
51
|
+
.stdout
|
52
|
+
.each_line
|
53
|
+
.detect { |l| l.start_with?("default") }
|
54
|
+
.split
|
55
|
+
network[:default_gateway] = default_line[1]
|
56
|
+
network[:default_interface] = default_line[5]
|
59
57
|
end
|
60
58
|
|
61
|
-
# Splits the ifconfig output
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
case lin
|
59
|
+
# Splits the ifconfig output into arrays of interface strings
|
60
|
+
shell_out("ifconfig -a").stdout.split(/\n(?=\w)/).each do |int_lines|
|
61
|
+
int_name, int_data = int_lines.split(":", 2)
|
62
|
+
|
63
|
+
ifaces[int_name] = Mash.new
|
64
|
+
ifaces[int_name][:addresses] ||= Mash.new
|
65
|
+
ifaces[int_name][:state] = (int_data.include?("<UP,") ? "up" : "down")
|
66
|
+
|
67
|
+
int_data.each_line do |line|
|
68
|
+
case line
|
72
69
|
when /flags=\S+<(\S+)>/
|
73
|
-
|
74
|
-
|
70
|
+
ifaces[int_name][:flags] = $1.split(",")
|
71
|
+
ifaces[int_name][:metric] = $1 if line =~ /metric\s(\S+)/
|
75
72
|
else
|
76
73
|
# We have key value pairs.
|
77
|
-
if
|
78
|
-
tmp_addr
|
74
|
+
if line =~ %r{inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(/(\d{1,2}))?}
|
75
|
+
tmp_addr = $1
|
76
|
+
tmp_prefix = $3
|
79
77
|
if tmp_prefix.nil?
|
80
|
-
netmask = hex_to_dec_netmask($1) if
|
78
|
+
netmask = hex_to_dec_netmask($1) if line =~ /netmask\s0x(\S+)\s/
|
81
79
|
unless netmask
|
82
80
|
tmp_prefix ||= "32"
|
83
81
|
netmask = IPAddr.new("255.255.255.255").mask(tmp_prefix.to_i).to_s
|
@@ -86,57 +84,51 @@ Ohai.plugin(:Network) do
|
|
86
84
|
netmask = IPAddr.new("255.255.255.255").mask(tmp_prefix.to_i).to_s
|
87
85
|
end
|
88
86
|
|
89
|
-
|
90
|
-
|
91
|
-
iface[interface][:addresses][tmp_addr][:netmask] = netmask
|
87
|
+
ifaces[int_name][:addresses][tmp_addr] = { "family" => "inet", "prefixlen" => tmp_prefix }
|
88
|
+
ifaces[int_name][:addresses][tmp_addr][:netmask] = netmask
|
92
89
|
|
93
|
-
if
|
94
|
-
|
90
|
+
if line =~ /broadcast\s(\S+)\s/
|
91
|
+
ifaces[int_name][:addresses][tmp_addr][:broadcast] = $1
|
95
92
|
end
|
96
|
-
elsif
|
97
|
-
# TODO do we have more properties on inet6 in aix? broadcast
|
98
|
-
|
99
|
-
|
93
|
+
elsif line =~ %r{inet6 ([a-f0-9\:]+)%?(\d*)/?(\d*)?}
|
94
|
+
# TODO: do we have more properties on inet6 in aix? broadcast
|
95
|
+
ifaces[int_name][:addresses] ||= Mash.new
|
96
|
+
ifaces[int_name][:addresses][$1] = { "family" => "inet6", "zone_index" => $2, "prefixlen" => $3 }
|
100
97
|
else
|
101
|
-
#
|
102
|
-
|
103
|
-
|
104
|
-
(
|
105
|
-
|
98
|
+
# add all key value data into the interface mash
|
99
|
+
# for example "tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1"
|
100
|
+
# has keys tcp_sendspace, tcp_recvspace, and rfc1323
|
101
|
+
line.split.each_slice(2) do |key, value|
|
102
|
+
ifaces[int_name][key] = value
|
106
103
|
end
|
107
104
|
end
|
108
105
|
end
|
109
106
|
end
|
110
107
|
|
111
108
|
# Query macaddress
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
iface[interface][:addresses][$1.upcase] = { "family" => "lladdr" }
|
117
|
-
macaddress $1.upcase unless shell_out("uname -W").stdout.to_i > 0
|
118
|
-
end
|
109
|
+
shell_out("entstat -d #{int_name}").stdout =~ /Hardware Address: (\S+)/
|
110
|
+
if $1
|
111
|
+
ifaces[int_name][:addresses][$1.upcase] = { "family" => "lladdr" }
|
112
|
+
macaddress $1.upcase unless shell_out("uname -W").stdout.to_i > 0
|
119
113
|
end
|
120
114
|
end # ifconfig stdout
|
121
115
|
|
122
116
|
# Query routes information
|
123
117
|
%w{inet inet6}.each do |family|
|
124
|
-
|
125
|
-
so_n.stdout.lines.each do |line|
|
118
|
+
shell_out("netstat -nrf #{family}").stdout.each_line do |line|
|
126
119
|
if line =~ /(\S+)\s+(\S+)\s+(\S+)\s+(\d+)\s+(\d+)\s+(\S+)/
|
127
120
|
interface = $6
|
128
|
-
|
129
|
-
|
130
|
-
|
121
|
+
ifaces[interface][:routes] ||= []
|
122
|
+
ifaces[interface][:routes] << Mash.new( destination: $1, family: family,
|
123
|
+
via: $2, flags: $3)
|
131
124
|
end
|
132
125
|
end
|
133
126
|
end
|
134
127
|
|
135
128
|
# List the arp entries in system.
|
136
|
-
so = shell_out("arp -an")
|
137
129
|
count = 0
|
138
|
-
|
139
|
-
|
130
|
+
network[:arp] ||= Mash.new
|
131
|
+
shell_out("arp -an").stdout.each_line do |line|
|
140
132
|
if line =~ /\s*(\S+) \((\S+)\) at ([a-fA-F0-9\:]+) \[(\w+)\] stored in bucket/
|
141
133
|
network[:arp][count] ||= Mash.new
|
142
134
|
network[:arp][count][:remote_host] = $1
|
@@ -145,6 +137,6 @@ Ohai.plugin(:Network) do
|
|
145
137
|
count += 1
|
146
138
|
end
|
147
139
|
end
|
148
|
-
network["interfaces"] =
|
140
|
+
network["interfaces"] = ifaces
|
149
141
|
end
|
150
142
|
end
|
@@ -23,17 +23,14 @@ Ohai.plugin(:Virtualization) do
|
|
23
23
|
collect_data(:aix) do
|
24
24
|
virtualization Mash.new
|
25
25
|
|
26
|
-
|
27
|
-
lpar_no = so.stdout.split($/)[0].split(/\s/)[0]
|
28
|
-
lpar_name = so.stdout.split($/)[0].split(/\s/)[1]
|
26
|
+
lpar_no, lpar_name = shell_out("uname -L").stdout.split(nil, 2)
|
29
27
|
|
30
28
|
unless lpar_no.to_i == -1 || (lpar_no.to_i == 1 && lpar_name == "NULL")
|
31
29
|
virtualization[:lpar_no] = lpar_no
|
32
30
|
virtualization[:lpar_name] = lpar_name
|
33
31
|
end
|
34
32
|
|
35
|
-
|
36
|
-
wpar_no = so.stdout.split($/)[0]
|
33
|
+
wpar_no = shell_out("uname -W").stdout.strip
|
37
34
|
if wpar_no.to_i > 0
|
38
35
|
virtualization[:wpar_no] = wpar_no
|
39
36
|
else
|
@@ -41,8 +38,11 @@ Ohai.plugin(:Virtualization) do
|
|
41
38
|
so = shell_out("lswpar -L").stdout.scan(/={65}.*?(?:EXPORTED\n\n)+/m)
|
42
39
|
wpars = Mash.new
|
43
40
|
so.each do |wpar|
|
44
|
-
|
41
|
+
wpar_heading = wpar.lines[1].split
|
42
|
+
wpar_name = wpar_heading[0]
|
43
|
+
|
45
44
|
wpars[wpar_name] = Mash.new
|
45
|
+
wpars[wpar_name][:state] = wpar_heading[2].downcase
|
46
46
|
|
47
47
|
wpar.scan(/^[A-Z]{4,}.*?[A-Z\:0-9]$.*?\n\n/m).each do |section|
|
48
48
|
|
@@ -31,7 +31,7 @@ Ohai.plugin(:Virtualization) do
|
|
31
31
|
|
32
32
|
# detect when in a jail or when a jail is actively running (not in stopped state)
|
33
33
|
so = shell_out("sysctl -n security.jail.jailed")
|
34
|
-
if so.stdout.
|
34
|
+
if so.stdout.strip.to_i == 1
|
35
35
|
virtualization[:system] = "jail"
|
36
36
|
virtualization[:role] = "guest"
|
37
37
|
virtualization[:systems][:jail] = "guest"
|
data/lib/ohai/plugins/c.rb
CHANGED
@@ -123,12 +123,12 @@ Ohai.plugin(:C) do
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def collect_xlc
|
126
|
-
#
|
127
|
-
|
126
|
+
# IBM XL C/C++ for AIX, V13.1.3 (5725-C72, 5765-J07)
|
127
|
+
# Version: 13.01.0003.0000
|
128
128
|
so = shell_out("xlc -qversion")
|
129
129
|
if so.exitstatus == 0 || (so.exitstatus >> 8) == 249
|
130
130
|
description = so.stdout.split($/).first
|
131
|
-
if description =~ /V(\d+\.\d+)/
|
131
|
+
if description =~ /V(\d+\.\d+(.\d+)?)/
|
132
132
|
@c[:xlc] = Mash.new
|
133
133
|
@c[:xlc][:version] = $1
|
134
134
|
@c[:xlc][:description] = description.strip
|