ohai 13.1.0 → 13.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +15 -6
- data/lib/ohai/common/dmi.rb +11 -13
- data/lib/ohai/dsl/plugin.rb +6 -8
- data/lib/ohai/dsl/plugin/versionvi.rb +1 -1
- data/lib/ohai/dsl/plugin/versionvii.rb +4 -4
- data/lib/ohai/mash.rb +1 -1
- data/lib/ohai/mixin/command.rb +3 -3
- data/lib/ohai/mixin/dmi_decode.rb +1 -1
- data/lib/ohai/mixin/ec2_metadata.rb +10 -10
- data/lib/ohai/mixin/os.rb +11 -11
- data/lib/ohai/mixin/softlayer_metadata.rb +2 -2
- data/lib/ohai/mixin/string.rb +1 -1
- data/lib/ohai/plugins/azure.rb +2 -2
- data/lib/ohai/plugins/c.rb +9 -10
- data/lib/ohai/plugins/darwin/cpu.rb +24 -20
- data/lib/ohai/plugins/darwin/hardware.rb +15 -9
- data/lib/ohai/plugins/digital_ocean.rb +2 -2
- data/lib/ohai/plugins/ec2.rb +5 -5
- data/lib/ohai/plugins/elixir.rb +1 -1
- data/lib/ohai/plugins/erlang.rb +2 -2
- data/lib/ohai/plugins/eucalyptus.rb +2 -2
- data/lib/ohai/plugins/go.rb +1 -1
- data/lib/ohai/plugins/hostname.rb +7 -10
- data/lib/ohai/plugins/ip_scopes.rb +2 -0
- data/lib/ohai/plugins/java.rb +19 -21
- data/lib/ohai/plugins/kernel.rb +1 -1
- data/lib/ohai/plugins/linux/cpu.rb +4 -0
- data/lib/ohai/plugins/linux/filesystem.rb +43 -30
- data/lib/ohai/plugins/linux/lsb.rb +1 -1
- data/lib/ohai/plugins/linux/mdadm.rb +9 -1
- data/lib/ohai/plugins/linux/network.rb +8 -12
- data/lib/ohai/plugins/linux/platform.rb +9 -1
- data/lib/ohai/plugins/linux/systemd_paths.rb +39 -0
- data/lib/ohai/plugins/mono.rb +1 -1
- data/lib/ohai/plugins/nodejs.rb +1 -1
- data/lib/ohai/plugins/openstack.rb +5 -5
- data/lib/ohai/plugins/packages.rb +8 -2
- data/lib/ohai/plugins/perl.rb +1 -1
- data/lib/ohai/plugins/php.rb +1 -1
- data/lib/ohai/plugins/powershell.rb +1 -1
- data/lib/ohai/plugins/python.rb +1 -1
- data/lib/ohai/plugins/rackspace.rb +4 -4
- data/lib/ohai/plugins/rust.rb +1 -1
- data/lib/ohai/plugins/solaris2/dmi.rb +3 -3
- data/lib/ohai/plugins/solaris2/network.rb +2 -2
- data/lib/ohai/plugins/ssh_host_key.rb +1 -1
- data/lib/ohai/plugins/uptime.rb +1 -1
- data/lib/ohai/plugins/{solaris2/zpools.rb → zpools.rb} +39 -16
- data/lib/ohai/util/file_helper.rb +2 -2
- data/lib/ohai/version.rb +1 -1
- data/spec/data/plugins/lslpp.output +1 -0
- data/spec/unit/plugins/darwin/cpu_spec.rb +66 -19
- data/spec/unit/plugins/darwin/hardware_spec.rb +2 -14
- data/spec/unit/plugins/linux/cpu_spec.rb +47 -0
- data/spec/unit/plugins/linux/filesystem_spec.rb +99 -9
- data/spec/unit/plugins/linux/mdadm_spec.rb +26 -1
- data/spec/unit/plugins/linux/network_spec.rb +8 -26
- data/spec/unit/plugins/linux/platform_spec.rb +41 -0
- data/spec/unit/plugins/linux/systemd_paths_spec.rb +122 -0
- data/spec/unit/plugins/packages_spec.rb +4 -0
- data/spec/unit/plugins/rackspace_spec.rb +3 -3
- data/spec/unit/plugins/zpools_spec.rb +242 -0
- metadata +7 -5
- data/spec/unit/plugins/solaris2/zpools_spec.rb +0 -153
data/lib/ohai/plugins/ec2.rb
CHANGED
@@ -43,10 +43,10 @@ Ohai.plugin(:EC2) do
|
|
43
43
|
# detect a version of '4.2.amazon'
|
44
44
|
if get_attribute(:dmi, :bios, :all_records, 0, :Version) =~ /amazon/
|
45
45
|
Ohai::Log.debug("Plugin EC2: has_ec2_dmi? == true")
|
46
|
-
|
46
|
+
true
|
47
47
|
else
|
48
48
|
Ohai::Log.debug("Plugin EC2: has_ec2_dmi? == false")
|
49
|
-
|
49
|
+
false
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -60,7 +60,7 @@ Ohai.plugin(:EC2) do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
Ohai::Log.debug("Plugin EC2: has_ec2_xen_uuid? == false")
|
63
|
-
|
63
|
+
false
|
64
64
|
end
|
65
65
|
|
66
66
|
# looks for the Amazon.com Organization in Windows Kernel data
|
@@ -69,10 +69,10 @@ Ohai.plugin(:EC2) do
|
|
69
69
|
# detect an Organization of 'Amazon.com'
|
70
70
|
if get_attribute(:kernel, :os_info, :organization) =~ /Amazon/
|
71
71
|
Ohai::Log.debug("Plugin EC2: has_amazon_org? == true")
|
72
|
-
|
72
|
+
true
|
73
73
|
else
|
74
74
|
Ohai::Log.debug("Plugin EC2: has_amazon_org? == false")
|
75
|
-
|
75
|
+
false
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
data/lib/ohai/plugins/elixir.rb
CHANGED
@@ -30,7 +30,7 @@ Ohai.plugin(:Elixir) do
|
|
30
30
|
languages[:elixir] = elixir
|
31
31
|
end
|
32
32
|
rescue Ohai::Exceptions::Exec
|
33
|
-
Ohai::Log.debug('Elixir
|
33
|
+
Ohai::Log.debug('Plugin Elixir: Could not shell_out "elixir -v". Skipping plugin')
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
data/lib/ohai/plugins/erlang.rb
CHANGED
@@ -34,7 +34,7 @@ Ohai.plugin(:Erlang) do
|
|
34
34
|
erlang[:nif_version] = output[2]
|
35
35
|
end
|
36
36
|
rescue Ohai::Exceptions::Exec
|
37
|
-
Ohai::Log.debug('Erlang
|
37
|
+
Ohai::Log.debug('Plugin Erlang: Could not shell_out "erl -eval \'erlang:display(erlang:system_info(otp_release)), erlang:display(erlang:system_info(version)), erlang:display(erlang:system_info(nif_version)), halt().\' -noshell". Skipping data')
|
38
38
|
end
|
39
39
|
|
40
40
|
begin
|
@@ -51,7 +51,7 @@ Ohai.plugin(:Erlang) do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
rescue Ohai::Exceptions::Exec
|
54
|
-
Ohai::Log.debug('Erlang
|
54
|
+
Ohai::Log.debug('Plugin Erlang: Could not shell_out "erl +V". Skipping data')
|
55
55
|
end
|
56
56
|
|
57
57
|
languages[:erlang] = erlang unless erlang.empty?
|
@@ -62,7 +62,7 @@ Ohai.plugin(:Eucalyptus) do
|
|
62
62
|
if looks_like_euca?
|
63
63
|
Ohai::Log.debug("Plugin Eucalyptus: looks_like_euca? == true")
|
64
64
|
eucalyptus Mash.new
|
65
|
-
|
65
|
+
fetch_metadata.each do |k, v|
|
66
66
|
# Eucalyptus 3.4+ supports IAM roles and Instance Profiles much like AWS
|
67
67
|
# https://www.eucalyptus.com/blog/2013/10/15/iam-roles-and-instance-profiles-eucalyptus-34
|
68
68
|
#
|
@@ -73,7 +73,7 @@ Ohai.plugin(:Eucalyptus) do
|
|
73
73
|
next if k == "iam" && !hint?("iam")
|
74
74
|
eucalyptus[k] = v
|
75
75
|
end
|
76
|
-
eucalyptus[:userdata] =
|
76
|
+
eucalyptus[:userdata] = fetch_userdata
|
77
77
|
else
|
78
78
|
Ohai::Log.debug("Plugin Eucalyptus: looks_like_euca? == false")
|
79
79
|
false
|
data/lib/ohai/plugins/go.rb
CHANGED
@@ -28,7 +28,7 @@ Ohai.plugin(:Go) do
|
|
28
28
|
languages[:go] = go
|
29
29
|
end
|
30
30
|
rescue Ohai::Exceptions::Exec
|
31
|
-
Ohai::Log.debug('Go
|
31
|
+
Ohai::Log.debug('Plugin Go: Could not shell_out "go version". Skipping plugin')
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -47,14 +47,12 @@ Ohai.plugin(:Hostname) do
|
|
47
47
|
# forward and reverse lookup to canonicalize FQDN (hostname -f equivalent)
|
48
48
|
# this is ipv6-safe, works on ruby 1.8.7+
|
49
49
|
def resolve_fqdn
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
nil
|
57
|
-
end
|
50
|
+
hostname = from_cmd("hostname")
|
51
|
+
addrinfo = Socket.getaddrinfo(hostname, nil).first
|
52
|
+
iaddr = IPAddr.new(addrinfo[3])
|
53
|
+
Socket.gethostbyaddr(iaddr.hton)[0]
|
54
|
+
rescue
|
55
|
+
nil
|
58
56
|
end
|
59
57
|
|
60
58
|
def collect_domain
|
@@ -149,8 +147,7 @@ Ohai.plugin(:Hostname) do
|
|
149
147
|
fqdn ourfqdn
|
150
148
|
end
|
151
149
|
rescue
|
152
|
-
Ohai::Log.debug(
|
153
|
-
"Plugin Hostname: hostname --fqdn returned an error, probably no domain set")
|
150
|
+
Ohai::Log.debug("Plugin Hostname: hostname --fqdn returned an error, probably no domain set")
|
154
151
|
end
|
155
152
|
domain collect_domain
|
156
153
|
end
|
@@ -24,6 +24,8 @@ Ohai.plugin(:IpScopes) do
|
|
24
24
|
begin
|
25
25
|
require "ipaddr_extensions"
|
26
26
|
|
27
|
+
Ohai::Log.warn("The IpScopes Ohai plugin has been deprecated and will be removed from Ohai 14 (April 2018).")
|
28
|
+
|
27
29
|
network["interfaces"].keys.sort.each do |if_name|
|
28
30
|
next if network["interfaces"][if_name]["addresses"].nil?
|
29
31
|
|
data/lib/ohai/plugins/java.rb
CHANGED
@@ -21,30 +21,28 @@ Ohai.plugin(:Java) do
|
|
21
21
|
depends "languages"
|
22
22
|
|
23
23
|
def get_java_info
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
java[:hotspot] = { "name" => $1, "build" => $3 }
|
40
|
-
end
|
24
|
+
so = shell_out("java -mx64m -version")
|
25
|
+
# Sample output:
|
26
|
+
# java version "1.8.0_60"
|
27
|
+
# Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
|
28
|
+
# Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
|
29
|
+
if so.exitstatus == 0
|
30
|
+
java = Mash.new
|
31
|
+
so.stderr.split(/\r?\n/).each do |line|
|
32
|
+
case line
|
33
|
+
when /(?:java|openjdk) version \"([0-9\.\_]+)\"/
|
34
|
+
java[:version] = $1
|
35
|
+
when /^(.+Runtime Environment.*) \((build)\s*(.+)\)$/
|
36
|
+
java[:runtime] = { "name" => $1, "build" => $3 }
|
37
|
+
when /^(.+ (Client|Server) VM) \(build\s*(.+)\)$/
|
38
|
+
java[:hotspot] = { "name" => $1, "build" => $3 }
|
41
39
|
end
|
42
|
-
|
43
|
-
languages[:java] = java unless java.empty?
|
44
40
|
end
|
45
|
-
|
46
|
-
|
41
|
+
|
42
|
+
languages[:java] = java unless java.empty?
|
47
43
|
end
|
44
|
+
rescue Ohai::Exceptions::Exec
|
45
|
+
Ohai::Log.debug('Plugin Java: Could not shell_out "java -mx64m -version". Skipping plugin')
|
48
46
|
end
|
49
47
|
|
50
48
|
# On Mac OS X, the development tools include "stubs" for JVM executables that
|
data/lib/ohai/plugins/kernel.rb
CHANGED
@@ -59,6 +59,10 @@ Ohai.plugin(:CPU) do
|
|
59
59
|
cpuinfo[current_cpu]["cache_size"] = $1
|
60
60
|
when /flags\s+:\s(.+)/
|
61
61
|
cpuinfo[current_cpu]["flags"] = $1.split(" ")
|
62
|
+
when /BogoMIPS\s+:\s(.+)/
|
63
|
+
cpuinfo[current_cpu]["bogomips"] = $1
|
64
|
+
when /Features\s+:\s(.+)/
|
65
|
+
cpuinfo[current_cpu]["features"] = $1.split(" ")
|
62
66
|
when /bogomips per cpu:\s(.+)/
|
63
67
|
cpuinfo["bogomips_per_cpu"] = $1
|
64
68
|
when /features\s+:\s(.+)/
|
@@ -30,8 +30,9 @@ Ohai.plugin(:Filesystem) do
|
|
30
30
|
name
|
31
31
|
end
|
32
32
|
|
33
|
-
def parse_line(line,
|
34
|
-
|
33
|
+
def parse_line(line, cmdtype)
|
34
|
+
case cmdtype
|
35
|
+
when "lsblk"
|
35
36
|
regex = /NAME="(\S+).*?" UUID="(\S*)" LABEL="(\S*)" FSTYPE="(\S*)"/
|
36
37
|
if line =~ regex
|
37
38
|
dev = $1
|
@@ -41,7 +42,7 @@ Ohai.plugin(:Filesystem) do
|
|
41
42
|
fs_type = $4
|
42
43
|
return { :dev => dev, :uuid => uuid, :label => label, :fs_type => fs_type }
|
43
44
|
end
|
44
|
-
|
45
|
+
when "blkid"
|
45
46
|
bits = line.split
|
46
47
|
dev = bits.shift.split(":")[0]
|
47
48
|
f = { :dev => dev }
|
@@ -54,7 +55,7 @@ Ohai.plugin(:Filesystem) do
|
|
54
55
|
end
|
55
56
|
return f
|
56
57
|
end
|
57
|
-
|
58
|
+
nil
|
58
59
|
end
|
59
60
|
|
60
61
|
def generate_device_view(fs)
|
@@ -142,36 +143,48 @@ Ohai.plugin(:Filesystem) do
|
|
142
143
|
end
|
143
144
|
end
|
144
145
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
146
|
+
# We used to try to decide if we wanted to run lsblk or blkid
|
147
|
+
# but they each have a variety of cases were they fail to report
|
148
|
+
# data. For example, there are a variety of cases where lsblk won't
|
149
|
+
# report unmounted filesystems, but blkid will. And vise-versa. Sweet.
|
150
|
+
# So for reliability, we'll run both, if we have them.
|
151
|
+
|
152
|
+
lsblk = which("lsblk")
|
153
|
+
blkid = which("blkid")
|
154
|
+
cmds = []
|
155
|
+
# These should be in order of preference... first writer wins.
|
156
|
+
if lsblk
|
157
|
+
cmds << "#{lsblk} -n -P -o NAME,UUID,LABEL,FSTYPE"
|
158
|
+
end
|
159
|
+
if blkid
|
160
|
+
cmds << blkid
|
151
161
|
end
|
152
162
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
keys_to_update
|
162
|
-
|
163
|
+
cmds.each do |cmd|
|
164
|
+
cmdtype = File.basename(cmd.split.first)
|
165
|
+
so = shell_out(cmd)
|
166
|
+
so.stdout.each_line do |line|
|
167
|
+
parsed = parse_line(line, cmdtype)
|
168
|
+
next if parsed.nil?
|
169
|
+
# lsblk lists each device once, so we need to update all entries
|
170
|
+
# in the hash that are related to this device
|
171
|
+
keys_to_update = []
|
172
|
+
fs.each_key do |key|
|
173
|
+
keys_to_update << key if key.start_with?("#{parsed[:dev]},")
|
174
|
+
end
|
163
175
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
176
|
+
if keys_to_update.empty?
|
177
|
+
key = "#{parsed[:dev]},"
|
178
|
+
fs[key] = Mash.new
|
179
|
+
fs[key][:device] = parsed[:dev]
|
180
|
+
keys_to_update << key
|
181
|
+
end
|
170
182
|
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
183
|
+
keys_to_update.each do |key|
|
184
|
+
[:fs_type, :uuid, :label].each do |subkey|
|
185
|
+
if parsed[subkey] && !parsed[subkey].empty?
|
186
|
+
fs[key][subkey] = parsed[subkey]
|
187
|
+
end
|
175
188
|
end
|
176
189
|
end
|
177
190
|
end
|
@@ -59,7 +59,15 @@ Ohai.plugin(:Mdadm) do
|
|
59
59
|
if line =~ /(md[0-9]+)/
|
60
60
|
device = Regexp.last_match[1]
|
61
61
|
pieces = line.split(/\s+/)
|
62
|
-
|
62
|
+
# there are variable numbers of fields until you hit the raid level
|
63
|
+
# everything after that is members...
|
64
|
+
# unless the array is inactive, in which case you don't get a raid
|
65
|
+
# level.
|
66
|
+
members = pieces.drop_while { |x| !x.start_with?("raid", "inactive") }
|
67
|
+
# drop the 'raid' too
|
68
|
+
|
69
|
+
members.shift unless members.empty?
|
70
|
+
devices[device] = members.map { |s| s.match(/(.+)\[\d\]/)[1] }
|
63
71
|
end
|
64
72
|
end
|
65
73
|
|
@@ -37,16 +37,12 @@ Ohai.plugin(:Network) do
|
|
37
37
|
File.exist? "/proc/net/if_inet6"
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
|
-
def find_ethtool_binary
|
45
|
-
["/sbin/ethtool", "/usr/sbin/ethtool"].find { |path| File.exist?(path) }
|
40
|
+
def ethtool_binary_path
|
41
|
+
@ethtool ||= which("ethtool")
|
46
42
|
end
|
47
43
|
|
48
44
|
def is_openvz?
|
49
|
-
::File.directory?("/proc/vz")
|
45
|
+
@openvz ||= ::File.directory?("/proc/vz")
|
50
46
|
end
|
51
47
|
|
52
48
|
def is_openvz_host?
|
@@ -151,11 +147,11 @@ Ohai.plugin(:Network) do
|
|
151
147
|
|
152
148
|
# determine layer 1 details for the interface using ethtool
|
153
149
|
def ethernet_layer_one(iface)
|
154
|
-
return iface unless
|
150
|
+
return iface unless ethtool_binary_path
|
155
151
|
keys = %w{ Speed Duplex Port Transceiver Auto-negotiation MDI-X }
|
156
152
|
iface.each_key do |tmp_int|
|
157
153
|
next unless iface[tmp_int][:encapsulation] == "Ethernet"
|
158
|
-
so = shell_out("#{
|
154
|
+
so = shell_out("#{ethtool_binary_path} #{tmp_int}")
|
159
155
|
so.stdout.lines do |line|
|
160
156
|
line.chomp!
|
161
157
|
Ohai::Log.debug("Plugin Network: Parsing ethtool output: #{line}")
|
@@ -175,10 +171,10 @@ Ohai.plugin(:Network) do
|
|
175
171
|
|
176
172
|
# determine ring parameters for the interface using ethtool
|
177
173
|
def ethernet_ring_parameters(iface)
|
178
|
-
return iface unless
|
174
|
+
return iface unless ethtool_binary_path
|
179
175
|
iface.each_key do |tmp_int|
|
180
176
|
next unless iface[tmp_int][:encapsulation] == "Ethernet"
|
181
|
-
so = shell_out("#{
|
177
|
+
so = shell_out("#{ethtool_binary_path} -g #{tmp_int}")
|
182
178
|
Ohai::Log.debug("Plugin Network: Parsing ethtool output: #{so.stdout}")
|
183
179
|
type = nil
|
184
180
|
iface[tmp_int]["ring_params"] = {}
|
@@ -471,7 +467,7 @@ Ohai.plugin(:Network) do
|
|
471
467
|
# The '@eth0:' portion doesn't exist on primary interfaces and thus is optional in the regex
|
472
468
|
IPROUTE_INT_REGEX = /^(\d+): ([0-9a-zA-Z@:\.\-_]*?)(@[0-9a-zA-Z]+|):\s/ unless defined? IPROUTE_INT_REGEX
|
473
469
|
|
474
|
-
if
|
470
|
+
if which("ip")
|
475
471
|
# families to get default routes from
|
476
472
|
families = [{
|
477
473
|
:name => "inet",
|
@@ -107,7 +107,7 @@ Ohai.plugin(:Platform) do
|
|
107
107
|
case platform
|
108
108
|
when /debian/, /ubuntu/, /linuxmint/, /raspbian/, /cumulus/
|
109
109
|
"debian"
|
110
|
-
when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
|
110
|
+
when /oracle/, /centos/, /redhat/, /scientific/, /enterpriseenterprise/, /xenserver/, /cloudlinux/, /ibm_powerkvm/, /parallels/, /nexus_centos/, /clearos/ # Note that 'enterpriseenterprise' is oracle's LSB "distributor ID"
|
111
111
|
"rhel"
|
112
112
|
when /amazon/
|
113
113
|
"amazon"
|
@@ -127,6 +127,8 @@ Ohai.plugin(:Platform) do
|
|
127
127
|
"exherbo"
|
128
128
|
when /alpine/
|
129
129
|
"alpine"
|
130
|
+
when /clearlinux/
|
131
|
+
"clearlinux"
|
130
132
|
end
|
131
133
|
end
|
132
134
|
|
@@ -232,6 +234,12 @@ Ohai.plugin(:Platform) do
|
|
232
234
|
elsif File.exist?("/etc/alpine-release")
|
233
235
|
platform "alpine"
|
234
236
|
platform_version File.read("/etc/alpine-release").strip()
|
237
|
+
elsif File.exist?("/usr/lib/os-release")
|
238
|
+
contents = File.read("/usr/lib/os-release")
|
239
|
+
if /Clear Linux/ =~ contents
|
240
|
+
platform "clearlinux"
|
241
|
+
platform_version contents[/VERSION_ID=(\d+)/, 1]
|
242
|
+
end
|
235
243
|
elsif lsb[:id] =~ /RedHat/i
|
236
244
|
platform "redhat"
|
237
245
|
platform_version lsb[:release]
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Davide Cavalca <dcavalca@fb.com>
|
3
|
+
# Copyright:: Copyright (c) 2017 Facebook
|
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
|
+
require "ohai/util/file_helper"
|
20
|
+
|
21
|
+
include Ohai::Util::FileHelper
|
22
|
+
|
23
|
+
Ohai.plugin(:SystemdPaths) do
|
24
|
+
provides "systemd_paths"
|
25
|
+
|
26
|
+
collect_data(:linux) do
|
27
|
+
systemd_path_path = which("systemd-path")
|
28
|
+
if systemd_path_path
|
29
|
+
systemd_path = shell_out(systemd_path_path)
|
30
|
+
|
31
|
+
systemd_paths Mash.new unless systemd_paths
|
32
|
+
|
33
|
+
systemd_path.stdout.each_line do |line|
|
34
|
+
key, val = line.split(":")
|
35
|
+
systemd_paths[key] = val.strip
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|