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
data/lib/ohai/plugins/lua.rb
CHANGED
data/lib/ohai/plugins/mono.rb
CHANGED
data/lib/ohai/plugins/network.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@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");
|
data/lib/ohai/plugins/nodejs.rb
CHANGED
data/lib/ohai/plugins/ohai.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@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");
|
@@ -19,7 +20,7 @@
|
|
19
20
|
Ohai.plugin(:OhaiTime) do
|
20
21
|
provides "ohai_time"
|
21
22
|
|
22
|
-
collect_data do
|
23
|
+
collect_data(:default, :target) do
|
23
24
|
ohai_time Time.now.to_f
|
24
25
|
end
|
25
26
|
end
|
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Matt Ray (<matt@chef.io>)
|
3
4
|
# Author:: Tim Smith (<tsmith@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/plugins/os.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Author:: Isa Farnik (<isa@chef.io>)
|
4
5
|
# Author:: Richard Manyanza (<liseki@nyikacraftsmen.com>)
|
5
|
-
# Copyright:: Copyright (c)
|
6
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
6
7
|
# Copyright:: Copyright (c) 2014 Richard Manyanza.
|
7
8
|
# License:: Apache License, Version 2.0
|
8
9
|
#
|
@@ -37,6 +38,10 @@ Ohai.plugin(:OS) do
|
|
37
38
|
os_version shell_out("sysctl -n kern.osreldate").stdout.split($/)[0]
|
38
39
|
end
|
39
40
|
|
41
|
+
collect_data(:target) do
|
42
|
+
os collect_os
|
43
|
+
end
|
44
|
+
|
40
45
|
collect_data do
|
41
46
|
os collect_os
|
42
47
|
os_version kernel[:release]
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# Author:: "Christian Höltje" <choltje@us.ibm.com>
|
2
3
|
# Author:: "Christopher M. Luciano" <cmlucian@us.ibm.com>
|
3
4
|
# Author:: Shahul Khajamohideen (<skhajamohid1@bloomberg.net>)
|
@@ -209,4 +210,24 @@ Ohai.plugin(:Packages) do
|
|
209
210
|
collect_ips_packages
|
210
211
|
collect_sysv_packages
|
211
212
|
end
|
213
|
+
|
214
|
+
def collect_system_profiler_apps
|
215
|
+
require "plist"
|
216
|
+
sp_std = shell_out("system_profiler SPApplicationsDataType -xml")
|
217
|
+
results = Plist.parse_xml(sp_std.stdout)
|
218
|
+
sw_array = results[0]["_items"]
|
219
|
+
sw_array.each do |pkg|
|
220
|
+
packages[pkg["_name"]] = {
|
221
|
+
"version" => pkg["version"],
|
222
|
+
"lastmodified" => pkg["lastModified"],
|
223
|
+
"source" => pkg["obtained_from"],
|
224
|
+
}
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
collect_data(:darwin) do
|
229
|
+
packages Mash.new
|
230
|
+
collect_system_profiler_apps
|
231
|
+
end
|
232
|
+
|
212
233
|
end
|
data/lib/ohai/plugins/passwd.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
3
|
Ohai.plugin(:Passwd) do
|
3
4
|
provides "etc", "current_user"
|
@@ -42,6 +43,62 @@ Ohai.plugin(:Passwd) do
|
|
42
43
|
end
|
43
44
|
|
44
45
|
collect_data(:windows) do
|
45
|
-
|
46
|
+
require "wmi-lite/wmi" unless defined?(WmiLite::Wmi)
|
47
|
+
|
48
|
+
unless etc
|
49
|
+
etc Mash.new
|
50
|
+
|
51
|
+
wmi = WmiLite::Wmi.new
|
52
|
+
|
53
|
+
etc[:passwd] = Mash.new
|
54
|
+
users = wmi.query("SELECT * FROM Win32_UserAccount WHERE LocalAccount = True")
|
55
|
+
users.each do |user|
|
56
|
+
uname = user["Name"].strip.downcase
|
57
|
+
Ohai::Log.debug("processing user #{uname}")
|
58
|
+
etc[:passwd][uname] = Mash.new
|
59
|
+
wmi_obj = user.wmi_ole_object
|
60
|
+
wmi_obj.properties_.each do |key|
|
61
|
+
etc[:passwd][uname][key.name.downcase] = user[key.name]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
etc[:group] = Mash.new
|
66
|
+
groups = wmi.query("SELECT * FROM Win32_Group WHERE LocalAccount = True")
|
67
|
+
groups.each do |group|
|
68
|
+
gname = group["Name"].strip.downcase
|
69
|
+
Ohai::Log.debug("processing group #{gname}")
|
70
|
+
etc[:group][gname] = Mash.new
|
71
|
+
wmi_obj = group.wmi_ole_object
|
72
|
+
wmi_obj.properties_.each do |key|
|
73
|
+
etc[:group][gname][key.name.downcase] = group[key.name]
|
74
|
+
end
|
75
|
+
|
76
|
+
# This is the primary reason that we're using WMI instead of powershell
|
77
|
+
# cmdlets - the powershell start up cost is huge, and you *must* do this
|
78
|
+
# query for every. single. group. individually.
|
79
|
+
|
80
|
+
# The query returns nothing unless you specify domain *and* name, it's
|
81
|
+
# a path, not a set of queries.
|
82
|
+
subq = "Win32_Group.Domain='#{group["Domain"]}',Name='#{group["Name"]}'"
|
83
|
+
members = wmi.query(
|
84
|
+
"SELECT * FROM Win32_GroupUser WHERE GroupComponent=\"#{subq}\""
|
85
|
+
)
|
86
|
+
etc[:group][gname]["members"] = members.map do |member|
|
87
|
+
mi = {}
|
88
|
+
info = Hash[
|
89
|
+
member["partcomponent"].split(",").map { |x| x.split("=") }.map { |a, b| [a, b.undump] }
|
90
|
+
]
|
91
|
+
if info.keys.any? { |x| x.match?("Win32_UserAccount") }
|
92
|
+
mi["type"] = :user
|
93
|
+
else
|
94
|
+
# Note: the type here is actually Win32_SystemAccount, because,
|
95
|
+
# that's what groups are in the Windows universe.
|
96
|
+
mi["type"] = :group
|
97
|
+
end
|
98
|
+
mi["name"] = info["Name"]
|
99
|
+
mi
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
46
103
|
end
|
47
104
|
end
|
data/lib/ohai/plugins/perl.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Joshua Timberman (<joshua@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");
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
Ohai.plugin(:Perl) do
|
20
20
|
provides "languages/perl"
|
21
|
-
depends "languages"
|
21
|
+
depends "languages".freeze
|
22
22
|
|
23
23
|
collect_data do
|
24
24
|
|
data/lib/ohai/plugins/php.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@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,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright:: Copyright (c)
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
# License:: Apache License, Version 2.0
|
4
4
|
#
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
Ohai.plugin(:Powershell) do
|
19
19
|
provides "languages/powershell"
|
20
|
-
depends "languages"
|
20
|
+
depends "languages".freeze
|
21
21
|
|
22
22
|
collect_data(:windows) do
|
23
23
|
|
data/lib/ohai/plugins/ps.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Author:: Bryan McLellan (<btm@loftninjas.org>)
|
4
|
-
# Copyright:: Copyright (c)
|
5
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
5
6
|
# Copyright:: Copyright (c) 2009 Bryan McLellan
|
6
7
|
# License:: Apache License, Version 2.0
|
7
8
|
#
|
data/lib/ohai/plugins/python.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Thom May (<thom@clearairturbulence.org>)
|
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");
|
@@ -19,7 +19,7 @@
|
|
19
19
|
Ohai.plugin(:Python) do
|
20
20
|
provides "languages/python"
|
21
21
|
|
22
|
-
depends "languages"
|
22
|
+
depends "languages".freeze
|
23
23
|
|
24
24
|
collect_data do
|
25
25
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Cary Penniman (<cary@rightscale.com>)
|
3
4
|
# License:: Apache License, Version 2.0
|
@@ -25,7 +26,7 @@ Ohai.plugin(:Rackspace) do
|
|
25
26
|
# true:: If kernel name matches
|
26
27
|
# false:: Otherwise
|
27
28
|
def has_rackspace_kernel?
|
28
|
-
kernel[:release].
|
29
|
+
kernel[:release].end_with?("-rscloud")
|
29
30
|
end
|
30
31
|
|
31
32
|
# Checks for rackspace provider attribute
|
@@ -161,8 +162,8 @@ Ohai.plugin(:Rackspace) do
|
|
161
162
|
unless rackspace[:public_ip].nil?
|
162
163
|
rackspace[:public_hostname] = begin
|
163
164
|
Resolv.getname(rackspace[:public_ip])
|
164
|
-
|
165
|
-
|
165
|
+
rescue Resolv::ResolvError, Resolv::ResolvTimeout
|
166
|
+
rackspace[:public_ip]
|
166
167
|
end
|
167
168
|
end
|
168
169
|
rackspace[:local_ipv4] = rackspace[:private_ip]
|
data/lib/ohai/plugins/ruby.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Adam Jacob (<adam@chef.io>)
|
3
4
|
# Copyright:: Copyright (c) Chef Software Inc.
|
@@ -48,13 +49,13 @@ Ohai.plugin(:Ruby) do
|
|
48
49
|
}
|
49
50
|
|
50
51
|
# Create a query string from above hash
|
51
|
-
env_string =
|
52
|
+
env_string = []
|
52
53
|
values.each_key do |v|
|
53
54
|
env_string << "#{v}=\#{#{values[v]}},"
|
54
55
|
end
|
55
56
|
|
56
57
|
# Query the system ruby
|
57
|
-
result = run_ruby "require 'rubygems'; puts %Q(#{env_string})"
|
58
|
+
result = run_ruby "require 'rubygems'; puts %Q(#{env_string.join})"
|
58
59
|
|
59
60
|
# Parse results to plugin hash
|
60
61
|
result.split(",").each do |entry|
|
data/lib/ohai/plugins/rust.rb
CHANGED
data/lib/ohai/plugins/scala.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
|
@@ -26,7 +27,7 @@ Ohai.plugin(:Scaleway) do
|
|
26
27
|
# looks for `scaleway` keyword in kernel command line
|
27
28
|
# @return [Boolean] do we have the keyword or not?
|
28
29
|
def has_scaleway_cmdline?
|
29
|
-
if
|
30
|
+
if file_exist?("/proc/cmdline") && /scaleway/.match?(file_read("/proc/cmdline"))
|
30
31
|
logger.trace("Plugin Scaleway: has_scaleway_cmdline? == true")
|
31
32
|
return true
|
32
33
|
end
|
data/lib/ohai/plugins/scsi.rb
CHANGED
data/lib/ohai/plugins/shard.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
Ohai.plugin(:ShardSeed) do
|
20
20
|
depends "hostname", "dmi", "machine_id", "machinename", "fips", "hardware", "kernel"
|
21
|
-
provides "shard_seed"
|
21
|
+
provides "shard_seed".freeze
|
22
22
|
|
23
23
|
def get_dmi_property(dmi, thing)
|
24
24
|
%w{system base_board chassis}.each do |section|
|
@@ -52,7 +52,7 @@ Ohai.plugin(:ShardSeed) do
|
|
52
52
|
def digest_algorithm
|
53
53
|
case Ohai.config[:plugin][:shard_seed][:digest_algorithm] || default_digest_algorithm
|
54
54
|
when "md5"
|
55
|
-
require "digest/md5"
|
55
|
+
require "digest/md5" unless defined?(Digest::MD5)
|
56
56
|
Digest::MD5
|
57
57
|
when "sha256"
|
58
58
|
require "openssl/digest"
|
data/lib/ohai/plugins/shells.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# Author:: Tim Smith (<tsmith@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");
|
@@ -20,9 +21,9 @@ Ohai.plugin(:Shells) do
|
|
20
21
|
provides "shells"
|
21
22
|
|
22
23
|
collect_data do
|
23
|
-
if
|
24
|
+
if file_exist?("/etc/shells")
|
24
25
|
shells []
|
25
|
-
|
26
|
+
file_open("/etc/shells").readlines.each do |line|
|
26
27
|
# remove carriage returns and skip over comments / empty lines
|
27
28
|
shells << line.chomp if line[0] == "/"
|
28
29
|
end
|
@@ -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>
|
@@ -39,7 +40,7 @@ Ohai.plugin(:Softlayer) do
|
|
39
40
|
logger.trace("Plugin Softlayer: looks_like_softlayer? == true")
|
40
41
|
metadata = fetch_metadata
|
41
42
|
softlayer Mash.new
|
42
|
-
metadata
|
43
|
+
metadata&.each { |k, v| softlayer[k] = v }
|
43
44
|
else
|
44
45
|
logger.trace("Plugin Softlayer: looks_like_softlayer? == false")
|
45
46
|
end
|