ohai 16.6.5 → 16.10.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -11
- data/bin/ohai +1 -0
- data/lib/ohai.rb +1 -0
- data/lib/ohai/application.rb +1 -0
- data/lib/ohai/common/dmi.rb +1 -0
- data/lib/ohai/config.rb +1 -0
- data/lib/ohai/dsl.rb +1 -0
- data/lib/ohai/dsl/plugin.rb +2 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +1 -2
- data/lib/ohai/exception.rb +1 -0
- data/lib/ohai/hints.rb +1 -0
- data/lib/ohai/log.rb +1 -0
- data/lib/ohai/mash.rb +1 -0
- data/lib/ohai/mixin/azure_metadata.rb +4 -3
- data/lib/ohai/mixin/chef_utils_wiring.rb +1 -0
- data/lib/ohai/mixin/command.rb +1 -0
- data/lib/ohai/mixin/constant_helper.rb +1 -0
- data/lib/ohai/mixin/dmi_decode.rb +1 -0
- data/lib/ohai/mixin/do_metadata.rb +3 -2
- data/lib/ohai/mixin/ec2_metadata.rb +37 -11
- data/lib/ohai/mixin/gce_metadata.rb +4 -3
- data/lib/ohai/mixin/http_helper.rb +1 -0
- data/lib/ohai/mixin/network_helper.rb +1 -0
- data/lib/ohai/mixin/os.rb +1 -0
- data/lib/ohai/mixin/scaleway_metadata.rb +3 -2
- data/lib/ohai/mixin/seconds_to_human.rb +1 -0
- data/lib/ohai/mixin/shell_out.rb +1 -0
- data/lib/ohai/mixin/softlayer_metadata.rb +2 -1
- data/lib/ohai/mixin/string.rb +1 -0
- data/lib/ohai/mixin/train_helpers.rb +1 -0
- data/lib/ohai/mixin/which.rb +1 -0
- data/lib/ohai/plugin_config.rb +1 -0
- data/lib/ohai/plugins/aix/kernel.rb +7 -4
- data/lib/ohai/plugins/aix/memory.rb +4 -3
- data/lib/ohai/plugins/aix/network.rb +51 -58
- data/lib/ohai/plugins/aix/platform.rb +3 -2
- data/lib/ohai/plugins/aix/uptime.rb +3 -2
- data/lib/ohai/plugins/aix/virtualization.rb +6 -6
- data/lib/ohai/plugins/azure.rb +1 -0
- data/lib/ohai/plugins/bsd/virtualization.rb +2 -1
- data/lib/ohai/plugins/c.rb +4 -3
- data/lib/ohai/plugins/chef.rb +1 -0
- data/lib/ohai/plugins/cloud.rb +2 -1
- data/lib/ohai/plugins/command.rb +1 -0
- data/lib/ohai/plugins/cpu.rb +27 -28
- data/lib/ohai/plugins/darwin/hardware.rb +1 -0
- data/lib/ohai/plugins/darwin/memory.rb +2 -3
- data/lib/ohai/plugins/darwin/network.rb +8 -9
- data/lib/ohai/plugins/darwin/platform.rb +1 -0
- data/lib/ohai/plugins/darwin/virtualization.rb +1 -0
- data/lib/ohai/plugins/digital_ocean.rb +3 -1
- data/lib/ohai/plugins/dmi.rb +5 -4
- data/lib/ohai/plugins/docker.rb +2 -1
- data/lib/ohai/plugins/dragonflybsd/memory.rb +9 -8
- data/lib/ohai/plugins/dragonflybsd/network.rb +1 -0
- data/lib/ohai/plugins/dragonflybsd/platform.rb +3 -2
- data/lib/ohai/plugins/ec2.rb +4 -0
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +1 -0
- data/lib/ohai/plugins/eucalyptus.rb +4 -1
- data/lib/ohai/plugins/filesystem.rb +1 -1
- data/lib/ohai/plugins/fips.rb +1 -0
- data/lib/ohai/plugins/freebsd/memory.rb +9 -8
- data/lib/ohai/plugins/freebsd/network.rb +1 -0
- data/lib/ohai/plugins/freebsd/platform.rb +3 -2
- data/lib/ohai/plugins/gce.rb +1 -0
- data/lib/ohai/plugins/go.rb +1 -1
- data/lib/ohai/plugins/groovy.rb +1 -1
- data/lib/ohai/plugins/grub2.rb +40 -0
- data/lib/ohai/plugins/haskell.rb +1 -0
- data/lib/ohai/plugins/hostname.rb +2 -2
- data/lib/ohai/plugins/init_package.rb +1 -0
- data/lib/ohai/plugins/java.rb +1 -0
- data/lib/ohai/plugins/kernel.rb +7 -8
- data/lib/ohai/plugins/keys.rb +1 -0
- data/lib/ohai/plugins/languages.rb +1 -0
- data/lib/ohai/plugins/libvirt.rb +4 -3
- data/lib/ohai/plugins/linode.rb +22 -14
- data/lib/ohai/plugins/linux/block_device.rb +1 -0
- data/lib/ohai/plugins/linux/hostnamectl.rb +3 -2
- data/lib/ohai/plugins/linux/interrupts.rb +1 -0
- data/lib/ohai/plugins/linux/ipc.rb +1 -0
- data/lib/ohai/plugins/linux/lsb.rb +6 -19
- data/lib/ohai/plugins/linux/lspci.rb +1 -1
- data/lib/ohai/plugins/linux/machineid.rb +1 -0
- data/lib/ohai/plugins/linux/mdadm.rb +1 -0
- data/lib/ohai/plugins/linux/memory.rb +37 -36
- data/lib/ohai/plugins/linux/network.rb +30 -4
- data/lib/ohai/plugins/linux/platform.rb +6 -2
- 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 +1 -0
- 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 +3 -2
- 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 +1 -0
- 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 +3 -2
- data/lib/ohai/plugins/openstack.rb +1 -0
- data/lib/ohai/plugins/os.rb +2 -1
- data/lib/ohai/plugins/packages.rb +2 -1
- data/lib/ohai/plugins/passwd.rb +2 -1
- data/lib/ohai/plugins/perl.rb +1 -1
- data/lib/ohai/plugins/php.rb +1 -1
- data/lib/ohai/plugins/platform.rb +1 -0
- data/lib/ohai/plugins/powershell.rb +1 -1
- data/lib/ohai/plugins/ps.rb +1 -0
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +6 -5
- 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 -1
- data/lib/ohai/plugins/shard.rb +1 -1
- data/lib/ohai/plugins/shells.rb +1 -0
- data/lib/ohai/plugins/softlayer.rb +1 -0
- data/lib/ohai/plugins/solaris2/dmi.rb +1 -0
- data/lib/ohai/plugins/solaris2/memory.rb +1 -0
- data/lib/ohai/plugins/solaris2/network.rb +2 -1
- data/lib/ohai/plugins/solaris2/platform.rb +6 -12
- data/lib/ohai/plugins/solaris2/virtualization.rb +3 -3
- data/lib/ohai/plugins/ssh_host_key.rb +1 -0
- data/lib/ohai/plugins/sysconf.rb +1 -0
- data/lib/ohai/plugins/timezone.rb +1 -0
- data/lib/ohai/plugins/train.rb +1 -1
- data/lib/ohai/plugins/uptime.rb +2 -1
- data/lib/ohai/plugins/virtualbox.rb +2 -1
- data/lib/ohai/plugins/vmware.rb +2 -2
- data/lib/ohai/plugins/windows/dmi.rb +1 -0
- data/lib/ohai/plugins/windows/drivers.rb +1 -0
- data/lib/ohai/plugins/windows/memory.rb +1 -0
- data/lib/ohai/plugins/windows/network.rb +2 -1
- data/lib/ohai/plugins/windows/platform.rb +1 -0
- data/lib/ohai/plugins/windows/system_enclosure.rb +1 -0
- data/lib/ohai/plugins/windows/virtualization.rb +1 -0
- data/lib/ohai/plugins/zpools.rb +5 -3
- data/lib/ohai/provides_map.rb +1 -0
- data/lib/ohai/runner.rb +3 -4
- data/lib/ohai/system.rb +1 -0
- data/lib/ohai/train_transport.rb +1 -0
- data/lib/ohai/util/file_helper.rb +1 -0
- data/lib/ohai/util/ip_helper.rb +2 -1
- data/lib/ohai/util/win32.rb +1 -0
- data/lib/ohai/version.rb +2 -1
- data/ohai.gemspec +2 -1
- metadata +14 -14
- data/lib/ohai/plugins/joyent.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 586f4b057af4307f5fb1abd420939bdb2320dade9b63723fbbcc58135a645a9b
|
4
|
+
data.tar.gz: b2c45c824a6ef7d69702f365f3e4d24bafe53b03afbfe0911e4bca8484556ad4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e9e3ef34974d09ee07eb5c492a9e80028ea8d80c6afa38e86921de16f6a1f85884bb032129fe8322b0bb1942d9447012f3f89f7d027591feecd82a8211a389a
|
7
|
+
data.tar.gz: 01fa6b22eee2fdfbead5f062efb6d346fc508b5b375edcddba0d56ed41c107b6a168e7532c573195b39f3a9b1ccdb24a67a3f914c056d2bedf88f1ac3e8aabe4
|
data/Gemfile
CHANGED
@@ -1,33 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
source "https://rubygems.org"
|
2
3
|
|
3
4
|
gemspec
|
4
5
|
|
5
6
|
# pull these gems from master of chef/chef so that we're testing against what we will release
|
6
|
-
gem "chef-config", git: "https://github.com/chef/chef", glob: "chef-config/chef-config.gemspec"
|
7
|
-
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"
|
8
9
|
|
9
10
|
# NOTE: do not submit PRs to add pry as a dep, add to your Gemfile.local
|
10
11
|
group :development do
|
11
|
-
gem "chefstyle",
|
12
|
+
gem "chefstyle", "1.6.2"
|
12
13
|
gem "ipaddr_extensions"
|
13
14
|
gem "rake", ">= 10.1.0"
|
14
15
|
gem "rspec-collection_matchers", "~> 1.0"
|
15
16
|
gem "rspec-core", "~> 3.0"
|
16
17
|
gem "rspec-expectations", "~> 3.0"
|
17
18
|
gem "rspec-mocks", "~> 3.0"
|
18
|
-
gem "rubocop-performance", "1.
|
19
|
+
gem "rubocop-performance", "1.9.2"
|
19
20
|
gem "rubocop-rspec"
|
20
21
|
end
|
21
22
|
|
22
|
-
group :docs do
|
23
|
-
gem "github-markup"
|
24
|
-
gem "redcarpet"
|
25
|
-
gem "yard"
|
26
|
-
end
|
27
|
-
|
28
23
|
group :debug do
|
29
24
|
gem "pry"
|
30
25
|
gem "pry-byebug"
|
31
|
-
gem "pry-stack_explorer"
|
26
|
+
gem "pry-stack_explorer"
|
32
27
|
gem "rb-readline"
|
33
28
|
end
|
data/bin/ohai
CHANGED
data/lib/ohai.rb
CHANGED
data/lib/ohai/application.rb
CHANGED
data/lib/ohai/common/dmi.rb
CHANGED
data/lib/ohai/config.rb
CHANGED
data/lib/ohai/dsl.rb
CHANGED
data/lib/ohai/dsl/plugin.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Author:: Claire McQuin (<claire@chef.io>)
|
@@ -217,7 +218,7 @@ module Ohai
|
|
217
218
|
def safe_get_attribute(*keys)
|
218
219
|
keys.inject(@data) do |attrs, key|
|
219
220
|
unless attrs.nil? || attrs.is_a?(Array) || attrs.is_a?(Hash)
|
220
|
-
raise TypeError
|
221
|
+
raise TypeError, "Expected Hash but got #{attrs.class}."
|
221
222
|
end
|
222
223
|
|
223
224
|
attrs[key]
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Serdar Sutay (<serdar@chef.io>)
|
3
4
|
# Copyright:: Copyright (c) Chef Software Inc.
|
@@ -194,8 +195,6 @@ module Ohai
|
|
194
195
|
# key? to avoid falsely instantiating a configuration hash.
|
195
196
|
if Ohai.config[:plugin].key?(snake_case_name)
|
196
197
|
Ohai.config[:plugin][snake_case_name]
|
197
|
-
else
|
198
|
-
nil
|
199
198
|
end
|
200
199
|
end
|
201
200
|
end
|
data/lib/ohai/exception.rb
CHANGED
data/lib/ohai/hints.rb
CHANGED
data/lib/ohai/log.rb
CHANGED
data/lib/ohai/mash.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Tim Smith (<tsmith@chef.io>)
|
3
4
|
# Copyright:: Copyright (c) Chef Software Inc.
|
@@ -31,12 +32,12 @@ module Ohai
|
|
31
32
|
#
|
32
33
|
module AzureMetadata
|
33
34
|
|
34
|
-
AZURE_METADATA_ADDR ||= "169.254.169.254"
|
35
|
+
AZURE_METADATA_ADDR ||= "169.254.169.254"
|
35
36
|
|
36
37
|
# it's important that the newer versions are at the end of this array so we can skip sorting it
|
37
38
|
AZURE_SUPPORTED_VERSIONS ||= %w{ 2017-04-02 2017-08-01 2017-12-01 2018-02-01 2018-04-02
|
38
|
-
|
39
|
-
|
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
|
40
41
|
|
41
42
|
def best_api_version
|
42
43
|
@api_version ||= begin
|
data/lib/ohai/mixin/command.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
$stderr.puts "WARN: Ohai::Mixin::Command is deprecated, please use Ohai::Mixin::ShellOut or remove if the reference is unnecessary"
|
2
3
|
require_relative "shell_out"
|
3
4
|
Ohai::Mixin::Command = Ohai::Mixin::ShellOut unless defined?(Ohai::Mixin::Command)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
# Author:: Dylan Page (<dpage@digitalocean.com>)
|
3
4
|
# License:: Apache License, Version 2.0
|
@@ -20,8 +21,8 @@ module Ohai
|
|
20
21
|
module Mixin
|
21
22
|
module DOMetadata
|
22
23
|
|
23
|
-
DO_METADATA_ADDR ||= "169.254.169.254"
|
24
|
-
DO_METADATA_URL ||= "/metadata/v1.json"
|
24
|
+
DO_METADATA_ADDR ||= "169.254.169.254"
|
25
|
+
DO_METADATA_URL ||= "/metadata/v1.json"
|
25
26
|
|
26
27
|
def http_client
|
27
28
|
Net::HTTP.start(DO_METADATA_ADDR).tap { |h| h.read_timeout = 6 }
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Tim Dysinger (<tim@dysinger.net>)
|
3
4
|
# Author:: Benjamin Black (<bb@chef.io>)
|
@@ -39,25 +40,33 @@ module Ohai
|
|
39
40
|
#
|
40
41
|
module Ec2Metadata
|
41
42
|
|
42
|
-
EC2_METADATA_ADDR ||= "169.254.169.254"
|
43
|
+
EC2_METADATA_ADDR ||= "169.254.169.254"
|
43
44
|
EC2_SUPPORTED_VERSIONS ||= %w{ 1.0 2007-01-19 2007-03-01 2007-08-29 2007-10-10 2007-12-15
|
44
|
-
|
45
|
-
|
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
|
46
48
|
EC2_ARRAY_VALUES ||= %w{security-groups local_ipv4s}.freeze
|
47
49
|
EC2_ARRAY_DIR ||= %w{network/interfaces/macs}.freeze
|
48
50
|
EC2_JSON_DIR ||= %w{iam}.freeze
|
49
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
|
+
#
|
50
59
|
def best_api_version
|
51
60
|
@api_version ||= begin
|
52
61
|
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}/ to determine the latest supported metadata release")
|
53
|
-
response = http_client.get("/")
|
62
|
+
response = http_client.get("/", { 'X-aws-ec2-metadata-token': v2_token })
|
54
63
|
if response.code == "404"
|
55
64
|
logger.trace("Mixin EC2: Received HTTP 404 from metadata server while determining API version, assuming 'latest'")
|
56
65
|
return "latest"
|
57
66
|
elsif response.code != "200"
|
58
67
|
raise "Mixin EC2: Unable to determine EC2 metadata version (returned #{response.code} response)"
|
59
68
|
end
|
60
|
-
#
|
69
|
+
# NOTE: Sorting the list of versions may have unintended consequences in
|
61
70
|
# non-EC2 environments. It appears to be safe in EC2 as of 2013-04-12.
|
62
71
|
versions = response.body.split("\n").sort
|
63
72
|
until versions.empty? || EC2_SUPPORTED_VERSIONS.include?(versions.last)
|
@@ -83,6 +92,23 @@ module Ohai
|
|
83
92
|
end
|
84
93
|
end
|
85
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
|
+
|
86
112
|
# Get metadata for a given path and API version
|
87
113
|
#
|
88
114
|
# Typically, a 200 response is expected for valid metadata.
|
@@ -92,7 +118,7 @@ module Ohai
|
|
92
118
|
def metadata_get(id, api_version)
|
93
119
|
path = "/#{api_version}/meta-data/#{id}"
|
94
120
|
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}#{path}")
|
95
|
-
response = http_client.get(path)
|
121
|
+
response = http_client.get(path, { 'X-aws-ec2-metadata-token': v2_token })
|
96
122
|
case response.code
|
97
123
|
when "200"
|
98
124
|
response.body
|
@@ -118,7 +144,7 @@ module Ohai
|
|
118
144
|
else
|
119
145
|
metadata_get(key, best_api_version)
|
120
146
|
end
|
121
|
-
elsif (
|
147
|
+
elsif (!key.eql?(id)) && (!key.eql?("/"))
|
122
148
|
name = key[0..-2]
|
123
149
|
sym = metadata_key(name)
|
124
150
|
if EC2_ARRAY_DIR.include?(name)
|
@@ -143,7 +169,7 @@ module Ohai
|
|
143
169
|
if key[-1..-1] != "/"
|
144
170
|
retr_meta = metadata_get("#{id}#{key}", api_version)
|
145
171
|
metadata[metadata_key(key)] = retr_meta || ""
|
146
|
-
elsif
|
172
|
+
elsif !key.eql?("/")
|
147
173
|
metadata[key[0..-2]] = fetch_dir_metadata("#{id}#{key}", api_version)
|
148
174
|
end
|
149
175
|
end
|
@@ -163,7 +189,7 @@ module Ohai
|
|
163
189
|
json = String(data)
|
164
190
|
parser = FFI_Yajl::Parser.new
|
165
191
|
metadata[metadata_key(key)] = parser.parse(json)
|
166
|
-
elsif
|
192
|
+
elsif !key.eql?("/")
|
167
193
|
metadata[key[0..-2]] = fetch_json_dir_metadata("#{id}#{key}", api_version)
|
168
194
|
end
|
169
195
|
end
|
@@ -173,13 +199,13 @@ module Ohai
|
|
173
199
|
|
174
200
|
def fetch_userdata
|
175
201
|
logger.trace("Mixin EC2: Fetching http://#{EC2_METADATA_ADDR}/#{best_api_version}/user-data/")
|
176
|
-
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 })
|
177
203
|
response.code == "200" ? response.body : nil
|
178
204
|
end
|
179
205
|
|
180
206
|
def fetch_dynamic_data
|
181
207
|
@fetch_dynamic_data ||= begin
|
182
|
-
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 })
|
183
209
|
|
184
210
|
if json?(response.body) && response.code == "200"
|
185
211
|
FFI_Yajl::Parser.parse(response.body)
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Ranjib Dey (<dey.ranjib@gmail.com>)
|
3
4
|
# License:: Apache License, Version 2.0
|
@@ -21,8 +22,8 @@ module Ohai
|
|
21
22
|
module GCEMetadata
|
22
23
|
|
23
24
|
# Trailing dot to host is added to avoid DNS search path
|
24
|
-
GCE_METADATA_ADDR ||= "metadata.google.internal."
|
25
|
-
GCE_METADATA_URL ||= "/computeMetadata/v1/?recursive=true"
|
25
|
+
GCE_METADATA_ADDR ||= "metadata.google.internal."
|
26
|
+
GCE_METADATA_URL ||= "/computeMetadata/v1/?recursive=true"
|
26
27
|
|
27
28
|
# fetch the meta content with a timeout and the required header
|
28
29
|
def http_get(uri)
|
@@ -71,7 +72,7 @@ module Ohai
|
|
71
72
|
#
|
72
73
|
# @return [Boolean] is there a trailing /?
|
73
74
|
def has_trailing_slash?(data)
|
74
|
-
!!
|
75
|
+
!!( data =~ %r{/$} )
|
75
76
|
end
|
76
77
|
|
77
78
|
def sanitize_key(key)
|
data/lib/ohai/mixin/os.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Jonathan Amiez (<jonathan.amiez@gmail.com>)
|
3
4
|
# License:: Apache License, Version 2.0
|
@@ -20,8 +21,8 @@ module Ohai
|
|
20
21
|
module Mixin
|
21
22
|
module ScalewayMetadata
|
22
23
|
|
23
|
-
SCALEWAY_METADATA_ADDR ||= "169.254.42.42"
|
24
|
-
SCALEWAY_METADATA_URL ||= "/conf?format=json"
|
24
|
+
SCALEWAY_METADATA_ADDR ||= "169.254.42.42"
|
25
|
+
SCALEWAY_METADATA_URL ||= "/conf?format=json"
|
25
26
|
|
26
27
|
# @return [Net::HTTP] net/http object without timeout set to 6
|
27
28
|
def http_client
|
data/lib/ohai/mixin/shell_out.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Alexey Karpik <alexey.karpik@rightscale.com>
|
3
4
|
# Author:: Peter Schroeter <peter.schroeter@rightscale.com>
|
@@ -22,7 +23,7 @@ require "uri" unless defined?(URI)
|
|
22
23
|
|
23
24
|
# https://softlayer.github.io/reference/services/SoftLayer_Resource_Metadata/
|
24
25
|
module ::Ohai::Mixin::SoftlayerMetadata
|
25
|
-
SOFTLAYER_API_QUERY_URL ||= "https://api.service.softlayer.com/rest/v3.1/SoftLayer_Resource_Metadata"
|
26
|
+
SOFTLAYER_API_QUERY_URL ||= "https://api.service.softlayer.com/rest/v3.1/SoftLayer_Resource_Metadata"
|
26
27
|
|
27
28
|
# fetch metadata items and build out hash of data
|
28
29
|
#
|
data/lib/ohai/mixin/string.rb
CHANGED
data/lib/ohai/mixin/which.rb
CHANGED
data/lib/ohai/plugin_config.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Joshua Timberman <joshua@chef.io>
|
3
4
|
# Author:: Isa Farnik (<isa@chef.io>)
|
@@ -23,10 +24,12 @@ Ohai.plugin(:Kernel) do
|
|
23
24
|
collect_data(:aix) do
|
24
25
|
kernel Mash.new
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
kernel[:
|
29
|
-
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]
|
30
33
|
kernel[:bits] = shell_out("getconf KERNEL_BITMODE").stdout.strip
|
31
34
|
|
32
35
|
modules = Mash.new
|